Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
gradientS
 
Posts: n/a
Default Range.Select Using Variables - need syntax


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-


--
gradientS
------------------------------------------------------------------------
gradientS's Profile: http://www.excelforum.com/member.php...o&userid=16563
View this thread: http://www.excelforum.com/showthread...hreadid=345829

  #2   Report Post  
HiArt
 
Posts: n/a
Default


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

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

HTH

Art


--
HiArt
------------------------------------------------------------------------
HiArt's Profile: http://www.excelforum.com/member.php...o&userid=19953
View this thread: http://www.excelforum.com/showthread...hreadid=345829

  #3   Report Post  
gradientS
 
Posts: n/a
Default


ahhhhh.... Thank you


--
gradientS
------------------------------------------------------------------------
gradientS's Profile: http://www.excelforum.com/member.php...o&userid=16563
View this thread: http://www.excelforum.com/showthread...hreadid=345829

  #4   Report Post  
Jim May
 
Posts: n/a
Default

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,


"gradientS" wrote in message
...

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-


--
gradientS
------------------------------------------------------------------------
gradientS's Profile:

http://www.excelforum.com/member.php...o&userid=16563
View this thread: http://www.excelforum.com/showthread...hreadid=345829



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
LINEST maximum number of predictor variables Peter N Excel Worksheet Functions 7 February 17th 05 10:14 AM
wrong syntax Asta Excel Discussion (Misc queries) 1 February 12th 05 09:39 AM
Index Match With 3 Variables Scooterdog Excel Worksheet Functions 5 January 2nd 05 07:05 PM
Vlookup Syntax Error YV New Users to Excel 9 December 23rd 04 05:28 PM
Previous Post - Correct Syntax Query Clarence Crow Excel Worksheet Functions 0 December 7th 04 05:35 AM


All times are GMT +1. The time now is 08:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"