View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett[_4_] Don Guillett[_4_] is offline
external usenet poster
 
Posts: 2,337
Default Loop through ranges

What is your goal here? Could be a simple find "QAPK"

--
Don Guillett
SalesAid Software

"hotherps " wrote in message
...
I have some code that runs down Rows 10-377, and it ranges in columns
from K to R. The rows always stay the same but the columns need to
advance to the right. The way I have it now is repeating all of the
same code for new range.
I already have a for statement looks like this:

For i = 1 To 377
For Each cell In Rows(i).Columns("K:AA")
Set rng = Nothing
If cell.Value = "QAPK" Then
Set rng = cell 'y ??
Exit For
End If

next sub:
For i = 1 To 377
For Each cell In Rows(i).Columns("AI:AJ")
Set rng = Nothing
If cell.Value = "QAPK" Then
Set rng = cell 'y ??
Exit For

The only difference is the new column names.

How can I tell it to loop through multiple ranges without creating a
new sub?

Thanks


---
Message posted from
http://www.ExcelForum.com/