View Full Version : Solved: remembering cell
tkaplan
07-12-2006, 02:10 PM
how do i set a variable to remember a cell address?
meaning i have a variable named curCell. i want curcell to refer to the active cell so that at a later time i can refer back to that cell.
i tried:
dim curcell as range
curcell=activecell.address
but i am getting an error.
thanks in advance.
tkaplan
mdmackillop
07-12-2006, 02:18 PM
Nearly there!
Dim curcell as range
set curcell=activecell
'DoThings
curcell.activate
tkaplan
07-12-2006, 02:21 PM
this is returning the value of the cell, i need the address. i tried .address but that still doesnt work.
mdmackillop
07-12-2006, 02:29 PM
It only looks that way. Curcell is actually the Range it is set to. This allows you to use it in various ways
eg
Range(curcell, curcell.offset(3,3)).interior.colorindex = 6
If you need the address then
Dim CurCell as string
CurCell = activecell.address
'DoThings
range(CurCell).activate
tkaplan
07-12-2006, 02:35 PM
yay!!! it worked:)
thank you so much.
just out of curiosity...
how come it makes it look like it's taking the value of the cell and not the address?
thansk again:)
mdmackillop
07-12-2006, 02:39 PM
It's usually the value which is the desired property so I guess it makes sense to "show" it. For most purposes you can use the range variable as the "value" without having to state it. To make things clear, you can use CurCell.Value or CurCell.Text etc.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.