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

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
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
 
Upvote 0
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)
                CellArray(ArraySize) = cell.Address
                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
 
Upvote 0
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
 
Upvote 0
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...
 
Upvote 0

Forum statistics

Threads
1,213,484
Messages
6,113,924
Members
448,533
Latest member
thietbibeboiwasaco

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top