**URGENT** Macro to find a Cell

  • Thread starter Thread starter Lost
  • Start date Start date
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!
 
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
 
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...
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top