How to set active cell range to an variable

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi. I want to fetch the address of the active cell so that I can use the
reference to build a formula. I have tried some, but so far I only got the
value of the active cell, and that doesn't help me at all.
 
I think ActiveCell.Address is what you are looking for.

Example:-
Dim strAddress as String

strAddress = ActiveCell.Address

Use Replace function if you want to remove $ signs.

Regards,

OssieMac
 
Thanks mate, that did the trick. I declared the variable wrong... :|


OssieMac skrev:
 
'Depending on exactly what you are doing
'the following can also be used for the
'address of the active cell.

Dim rowNumber As Single
Dim colNumber As Single

rowNumber = ActiveCell.Row

colNumber = ActiveCell.Column

Cells(rowNumber, colNumber) = "This is active cell"

regards,

OssieMac
 
if you don't want the $'s, use this:


strAddress = ActiveCell.Address(0, 0)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top