John_Mason
New Member
- Joined
- Jul 27, 2010
- Messages
- 4
Hello,
I want to identify the last row in a spreadsheet that has data.
I have defined an Integer to hold the output from CountA i.e.
Dim NoOfRows As Integer
NoOfRows = Application.WorksheetFunction.CountA("Sheet1!A2:A65535")
When I try to use Range ("A2:NoOfRows").Select I get Run-time error '1004':
Method 'Range' of object '_Global' failed.
I am a novice VBA person so this is probably a school boy error. Any suggestions please.
I want to identify the last row in a spreadsheet that has data.
I have defined an Integer to hold the output from CountA i.e.
Dim NoOfRows As Integer
NoOfRows = Application.WorksheetFunction.CountA("Sheet1!A2:A65535")
When I try to use Range ("A2:NoOfRows").Select I get Run-time error '1004':
Method 'Range' of object '_Global' failed.
I am a novice VBA person so this is probably a school boy error. Any suggestions please.