0

I am trying to copy data from the tab of one workbook to the tab of another. I want to get the row count from the workbook that I am copying from but the code is in the workbook I am copying to. My code is as follows:

''' rowCount = Workbooks(reportbook).Sheet1.Cells(100000, 1).End(xlUp).Row '''

I get an "Object does not support this property or method" error. I want to use the sheet's Codename (Sheet1) instead of the Index (Sheets(1)) or Name ("Sheet 1"). Using the Index and Name both give no error but the name and/or order of the sheets might change in the workbook I copying from.

It seems that trying to specify which of the two workbook I want to look for Sheet1 in is causing the issue. If I remove "Workbooks(reportbook)" then the code works but counts from the wrong workbook.

braX
  • 11,506
  • 5
  • 20
  • 33
bpep
  • 1

0 Answers0