Current Cell address

Padawan

Active Member
Joined
Apr 9, 2002
Messages
395
Board

Need one line of code tonight, please.

How do I find or reference the cell address of the current cell without using ActiveCell?

What I'm trying to get is the range address, so I could use ActiveCell if I could get the address from it.

Thanks
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Let me re-state my question.

I need a line of code, please, to set a variable named NewCell to the address of the activecell.

I tried Set NewCell = Activecell.Address but keep getting an error.

When I used Set NewCell = ActiveCell, it referenced the string actually in the cell. Then when I added a row, the NewCell followed the string but I wanted to reference the empty cell.

Thanks
 
Upvote 0
You could set newcell as a string variable to hold the address of the current active cell, to retrieve the value in that cell at a later date use range(address).value

Code:
Dim newcell As String: newcell = ActiveCell.Address
y = Range(newcell).Value
 
Upvote 0
You could do it with newcell as a range rather than a string if you preferred:

Code:
Dim newcell As Range
Dim value As Variant
Set newcell = Range(ActiveCell.Address)
value = newcell.Value
 
Upvote 0
That helps a lot. It's midnight here. My head is starting to bob up and down.

I'm going AFK.

Thanks, again.
 
Upvote 0

Forum statistics

Threads
1,213,494
Messages
6,113,988
Members
448,538
Latest member
alex78

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top