ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Loop through ranges columns (https://www.excelbanter.com/excel-programming/292720-loop-through-ranges-columns.html)

hotherps[_32_]

Loop through ranges columns
 
I'm using a For next loop to determine the number of rows and columns m
code should run in.

What If I have multiple ranges of columns that need to be ru
indepenedently. Let's say A:K then L:R then S:Z with the rows at
constant of 1 to 100

For Each Cell in Range ("A:K") ??How do I state the next range?

Does there need to be a Loop at the bottom of the code?


Thanks:confused

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


Otto Moehrbach[_6_]

Loop through ranges columns
 
I don't understand what you're doing but this is how you would get one For
loop to operate on those 3 ranges.
Do something like this:
Dim i as Range
Set TheWholeRng=Union(Range("A1:K100"),Range
("L1:R100"),Range("S1:Z100"))
For Each i In TheWholeRng
'What you want to do with each cell
Next i

"hotherps " wrote in message
...
I'm using a For next loop to determine the number of rows and columns my
code should run in.

What If I have multiple ranges of columns that need to be run
indepenedently. Let's say A:K then L:R then S:Z with the rows at a
constant of 1 to 100

For Each Cell in Range ("A:K") ??How do I state the next range?

Does there need to be a Loop at the bottom of the code?


Thanks:confused:


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





All times are GMT +1. The time now is 01:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com