excel - How does the CopyFromRecordset rs work -
hi want know how part of code pasting data? why not pasting data 1 row below other set targetrange = targetrange.cells(a, 1) set cn1 = new adodb.connection cn1.open "provider=microsoft.ace.oledb.12.0; data source=" & dbfullname & ";" set rs = new adodb.recordset rs .open sqlstr, cn1, , adcmdtext if = 1 intcolindex = 0 rs.fields.count - 1 ' field names targetrange.offset(0, intcolindex).value = "'" & rs.fields(intcolindex).name next intcolindex targetrange.offset(1, 0).copyfromrecordset rs ' recordset data elseif <> 1 targetrange.offset(1, 0).copyfromrecordset rs end if end rs.close set rs = nothing cn1.close set cn1 = nothing the context provided incomplete is there other code before posted? is part of function or entire function? where variables declared , initialized? what issue - not pasting anything,...