# 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

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

#### 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
5
Views
163
Replies
7
Views
385
Replies
1
Views
208
Replies
8
Views
305
Replies
5
Views
75

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,163,849
Messages
5,833,943
Members
430,248
Latest member
bobbywibowo76

### 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.

### Which adblocker are you using?

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