how to select a cell with the address as string ("\$D\$21

wene

New Member
how to select a cell with the address as string ("\$D\$21")

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

Scott Huish

MrExcel MVP
Re: how to select a cell with the address as string ("\$

Is this what you mean?

=INDIRECT("\$D\$21")

Though, I'm guessing there is more to this question, because this would be easier:

=\$D\$21

wene

New Member
Re: how to select a cell with the address as string ("\$

as you can see, i'm storing a collection of cell address in a Array as strings:
Code:
``````        For Each cell In Selection
MsgBox (cell.Interior.ColorIndex)
If cell.Interior.ColorIndex = xlColorIndexNone Then
ArraySize = ArraySize + 1
ReDim Preserve CellArray(ArraySize)
On Error Resume Next
cell.Interior.ColorIndex = 2
cell.Interior.Pattern = xlSolid
End If
Next cell

(..)

Dim iterations As Integer
iterations = 0
While iterations < ArraySize
iterations = iterations + 1``````
and now the intuitive approach to read out the Array and change the cell's color:
Code:
``````            cell(CellArray(iterations)).Select
Selection.Interior.ColorIndex = 4
Wend``````

Scott Huish

MrExcel MVP
Re: how to select a cell with the address as string ("\$

OK, simple example:

Code:
``````Sub Test()
Dim x, y As Integer
x = Array("\$D\$21", "\$E\$7")
For y = 0 To UBound(x)
Range(x(y)).Interior.ColorIndex = 4
Next y
End Sub``````

wene

New Member
Re: how to select a cell with the address as string ("\$

THANKS!!!
Code:
``Range(CellArray(iterations)).Select``

range() accepts a string as parameter...

just perfect...

Replies
4
Views
116
Replies
5
Views
142
Replies
13
Views
539
Replies
1
Views
276
Replies
3
Views
127

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

1,151,824
Messages
5,766,657
Members
425,367
Latest member
Boboka

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.

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

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