Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Selecting a Range

Dim cell As Range
Dim iRow As Long
Dim iCnt As Long
For Each cell In Range("a3:a250")
If InStr(cell, "Trex") Then
Do
iRow = iRow + 1
If IsEmpty(cell.Offset(iRow, 0)) Then
iCnt = iCnt + 1
Else
iCnt = 0
End If
Loop Until InStr(cell.Offset(iRow, 0).Value, "Trex") _
Or iCnt = 5 Or cell.Row + iRow = 250
cell.Resize(iRow + 1).EntireRow.Select
Exit For
End If
Next


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"JV" wrote in message
...
Dim cell As Range
For Each cell In Range("a3:a250")
If InStr(cell, "Trex") Then
cell.Offset(0, 0).EntireRow.Select
End If
Next
Above works but now I want to make it highlight in addition to the row
highlighted all rows afterwards until the next time it finds "Trex" or 5
consecutive empty cells.



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
Selecting range in list of range names depending on a cell informa Courreges Excel Discussion (Misc queries) 2 June 19th 06 10:59 AM
Help please in selecting range dependent on another range MickJJ Excel Programming 2 January 10th 05 12:01 PM
Selecting a Range inside a range hcova Excel Programming 0 July 13th 04 03:26 PM
Selecting A Range Patrick Molloy Excel Programming 0 July 22nd 03 07:54 AM
Selecting A Range John Wilson Excel Programming 0 July 22nd 03 03:05 AM


All times are GMT +1. The time now is 08:07 PM.

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"