ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Get address of Cell (https://www.excelbanter.com/excel-programming/309896-get-address-cell.html)

Terry V

Get address of Cell
 
Hello
I am using:
Dim x as Range
Range("B65536").End(xlUp) to find the last used cell.
Ive tried assigning a variable to this and it returns the value of the cell

x = Range("B65536").End(xlUp) ' returns cell value
I need x to return the cell address without activating the cell.

x = Range("B65536").End(xlUp).Address ' does not work

Any suggestions?
Thank you
Terry



Norman Jones

Get address of Cell
 
Hi Terry,

Sub Tester02()
Dim x As Range
Set x = Range("B65536").End(xlUp)
MsgBox x.Address
End Sub

---
Regards,
Norman



"Terry V" wrote in message
...
Hello
I am using:
Dim x as Range
Range("B65536").End(xlUp) to find the last used cell.
Ive tried assigning a variable to this and it returns the value of the
cell

x = Range("B65536").End(xlUp) ' returns cell value
I need x to return the cell address without activating the cell.

x = Range("B65536").End(xlUp).Address ' does not work

Any suggestions?
Thank you
Terry





Tom Ogilvy

Get address of Cell
 
but

Sub Tester03()
Dim x as String
x = Range("B65536").End(xlUp).Address ' does work
msgbox x
End sub

would work as well. Just for the OP's benefit.

--
Regards,
Tom Ogilvy

"Norman Jones" wrote in message
...
Hi Terry,

Sub Tester02()
Dim x As Range
Set x = Range("B65536").End(xlUp)
MsgBox x.Address
End Sub

---
Regards,
Norman



"Terry V" wrote in message
...
Hello
I am using:
Dim x as Range
Range("B65536").End(xlUp) to find the last used cell.
Ive tried assigning a variable to this and it returns the value of the
cell

x = Range("B65536").End(xlUp) ' returns cell value
I need x to return the cell address without activating the cell.

x = Range("B65536").End(xlUp).Address ' does not work

Any suggestions?
Thank you
Terry








All times are GMT +1. The time now is 06:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com