I have two sheets, Raw Data and a user-created varSheetName.
I dump a huge data extract into Raw Data, and extract columns (based on the header field, which I can find no problem) to the new sheet. The column number the header is found on is always going to be different, as will be the number of rows below it.
EX: I find the header "models/0/availability", on column ?, with ?? rows to copy to varSheetName.
Knowing the copy & paste column #, and the last row #, I run this code:
With ThisWorkbook.Sheets(varSheetName)
.Range(.Cells(intPasteRow, intPasteCol), .Cells(intLastRow, intPasteCol)).Value = Worksheets("Raw Data").Range(.Cells(1, iCopyCol), .Cells(intLastRow, iCopyCol)).Value
End With
I get
Runtime 1004: Application-defined or object-defined error