Home:ALL Converter>Convert cell address as string to cell range

Convert cell address as string to cell range

Ask Time:2022-07-25T23:34:30         Author:Hugo Almeida

Json Formatter

I have a cell J9 whose value is the address of other random cells, for example "$CW$178". I want then to add a shape in a cell whose address is the same as J9.Value, so in this case I would've added a circle in the $CW$178 cell. However, everytime I execute my macro I get returned Run-time error '424': Object required.

This is my code:

Sub button0_Click()
Cell2 = Range("J9").Value
Set shpOval = Shapes.AddShape(msoShapeOval, Cell2.Left, Cell2.Top, 50, 50) <--Debug highlights this line

Author:Hugo Almeida,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/73111820/convert-cell-address-as-string-to-cell-range
yy