**URGENT** Macro to find a Cell

L

Lost

If I have the column row references given on 2 cells in my spreadsheet, I
need a macro to read the contents of the two cells and then select that
particular cell.

Here is the current code I have:

Sub test()

Sheets("Revised").Activate
ActiveSheet.Cells(1, 2).Select

End Sub

In the existing code the column/row references are static. Ideally I would
like the column/row references to be dependent on what figures are listed in
cells A1 & B1, however you cannot simply enter those in 1 & 2's spot or it
will error. Help!
 
J

JLGWhiz

Here is one way:

Dim x As Long
Dim y As long

x = Range("A1").Value
y = Range("B1").Value

Sheets("Revised").Activate
ActiveSheet.Cells(x, y).Select
 
J

Jim Thomlinson

I would be inclined to leave Y as being of type variant. That way the user
can enter either a column letter or number as needed...
 
J

JLGWhiz

Hi Jim, That's true. I just looked at the syntax the OP used and went with
that. I don't even know which cells were to be used for row or column, but
thought I would at least get them pointed in the right direction.
 
Top