我从workbook1启动以下代码,并想要计算workbook2(wb.Name)中的行数。为什么partII会从workbook1返回行数?
Dim partII As String
Workbooks(wb.Name).Activate
Workbooks(wb.Name).Worksheets("sheet1").Select
partII = Range("A" & Rows.Count).End(xlUp).Row
For Each myRecord In Workbooks(wb.Name).Worksheets("sheet1").Range("A1:A" & partII)