-
2007 compatibility
I came across this problem, which I think may be quite common in opening pre 2007 workbooks from Excel 2007
[VBA]LastRow = Workbooks("Test.xls").Sheets(1).Range("A" & Rows.Count).End(xlUp).Row
[/VBA]
In this case, Rows.Count can take the value of 1048576 from my 2007 workbook, which causes an error as it does not exist in Test.
Fully qualify the Range and the Rows.count by changing to
[VBA]
Sub Test()
With Workbooks("Test.xls").Sheets(1)
LastRow = .Range("A" & .Rows.Count).End(xlUp).Row
End With
End Sub
[/VBA]
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules