View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Juan Pablo González Juan Pablo González is offline
external usenet poster
 
Posts: 226
Default Why doesn't 'Range("A65000").Select' work?

Using Select fails sometimes for no apparent or reasonable reason. In your
case, you can do without it

lngLastDataRow = Cells(Rows.Count, 1).End(xlUp).Row

all in one go, no selection.

--
Regards,

Juan Pablo González
Excel MVP

"Alan" wrote in message
...
Hello world:

I'm using Excel 2003. I'm baffled.
Something that has worked for me since Excel 5 no longer works.
Maybe someone out there can explain what I'm doing wrong.

When I go to a sheet, I often have code like this to tell me the last data
row:
'--Find last data row
Range("A65000").Select
Selection.End(xlUp).Select
lngLastDataRow = ActiveCell.Row

That has worked fine for years, and it works fine for other sheets in this
workbook.
On one sheet, however, I get the following message when it gets to the
first command:
Error 1004
Select Method of Range Class Failed

I have checked the sheet's Protection, and it is all off.
I have created a new workbook with just the two sheets necessary for this
code, and still the error.

What have I done to create this error?

Help!

Alan