![]() |
How to set active cell range to an variable
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. |
How to set active cell range to an variable
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 "Jørgen Andreassen" wrote: 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. |
How to set active cell range to an variable
Thanks mate, that did the trick. I declared the variable wrong... :|
OssieMac skrev: 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 "Jørgen Andreassen" wrote: 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. |
How to set active cell range to an variable
'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 "OssieMac" wrote: 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 "Jørgen Andreassen" wrote: 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. |
How to set active cell range to an variable
if you don't want the $'s, use this:
strAddress = ActiveCell.Address(0, 0) -- Gary "OssieMac" wrote in message ... 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 "Jørgen Andreassen" wrote: 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. |
All times are GMT +1. The time now is 09:00 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com