View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
OssieMac OssieMac is offline
external usenet poster
 
Posts: 2,510
Default Set variable to active cell address

Hi,


Dim rngAddr As String
Dim rng As Range

Set rng = ActiveCell

rngAddr = rng.Address 'returns $A$1
rngAddr = rng.Address(0, 0) 'returns A1
rngAddr = rng.Address(0, 1) 'returns $A1
rngAddr = rng.Address(1, 0) 'returns A$1

'Use address like this

Range (rngAddr)

--
Regards,

OssieMac


"shelfish" wrote:

I just need to set the value of a variable to the "A1" address of the
active cell. I feel like I've tried everything, but shouldn't this
work....

Dim rng as Range

Set rng = activecell [results in active cell's
value]
Set rng = activecell.address [throws error]

Thanks all,
Shelton.