Range.Select Using Variables - need syntax

  • Thread starter Thread starter gradientS
  • Start date Start date
G

gradientS

Dim firstrowOLD As Long
Dim lastrowOLD As Long

Cells.Find(What:="Text1", -etc-)

firstrowOLD = ActiveCell.Row

Cells.Find(What:="Text2", -etc-)

lastrowOLD = ActiveCell.Row

-need correct syntax for next line-

Range("H" & firstrowOLD : "I" & lastrowOLD).Select

-I get a Compile error: Expected List Seperator at the colon-
-not sure how this is different from Range("H25:I30").Select-
 
Range("H" & firstrowOLD & ":I" & lastrowOLD).Select

i.e. the quotes just before the "I" were in the wrong place.

HTH

Art
 
When I enter your code (for testing) the following line
shows IN RED - indicating bad syntax:
Cells.Find(What:="Text1", -etc-)
Even removing the etc and retrying as
Cells.Find(What:="Text1")
DOESN't Work,
What do I need to do to move forward?
TIA,
 

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