View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett[_4_] Don Guillett[_4_] is offline
external usenet poster
 
Posts: 2,337
Default Selecting a cell

OP said In my spreadsheet I have a range of cells (in one column)
I guess I should not have assumed that this was the ONLY column
so
Sub ddddd()' this should work
Range([myvars].Range("a65536").End(xlUp).Address).Select
End Sub

"Tom Ogilvy" wrote in message
...
Just for information -
That goes to the last cell in the usedrange of the sheet, not the last

cell
in the range myvars.


Regards,
Tom Ogilvy


"Don Guillett" wrote in message
...
try this

Sub gotolastcell()
x = [myvars].SpecialCells(xlLastCell).Address
Range(x).Select
End Sub

or a one liner
Sub ddd()
Range([myvars].SpecialCells(xlLastCell).Address).Select
End Sub


"Bob" wrote in message
...
Hi,

In my spreadsheet I have a range of cells (in one column)
which I have given a name, MYVARS.

Thus MYVARS is physically the Sheet2!A1:A17 range.

Now, from within a macro, I want to provide this name
(MYVARS) and the macro must find out its real range and go
to the last cell in that range;

Thus, if I provide MYVARS as input to the macro, it should
position my cursor to the cell Sheet2!A17 because that is
the last cell in the range MYVARS.

Can somebody help?