View Full Version : [SOLVED:] Looping through a Range of Data
Sully1440
01-25-2018, 12:54 PM
How can I loop through a range of data (A5:H20) such that the following code is called over and over going down cells E and G until it reaches the bottom with no data
Call CODE_ABC(Range("E11"), Range("G11"))
Part 2:
How can do this based on specific text in column A (for example when it only sees the name "Task A", Task "B", etc.).
paulked
01-25-2018, 01:29 PM
Hi and welcome to the forum.
This is one of many ways:
Sub Ked()
Dim x As Long
For x = 5 To 7 ' E-G Column numbers
If Cells(1, x) = "Task A" Then Call CODE_ABC(Cells(11, x)) 'Only call sub if condition met
Next
End Sub
offthelip
01-25-2018, 04:54 PM
This is cross posted here:
https://www.mrexcel.com/forum/excel-questions/1040595-looping-through-range-data.html
I answered this on the mrexcel site, so i am not happy: please read about cross posting:
https://www.excelguru.ca/content.php?184
Sully1440
01-26-2018, 05:43 AM
Apologies on the cross posting. I value these types of sites very much. I read the link.
Please take this as my sincere apologies.
BTW, the code works great. Thank you :)
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.