I have these two named ranges, each 1 column by 32 rows.
Each have data I need to use that is comparable row to row.
I need to advance each For Each in each Range simultaneously.
How can I make this statement work?
Any suggestons?For Each ofCell In Range("Order_Flavors") row = 2 For Each fCell In Range("Flavors") And For Each Cell In Range("Expiration_Dates") If ofCell = fCell Then Do Until Cell.Value > 5 Cells(row, column).Value = Cells(row, column).Value + 1 j = j + 1 k = k + 1 Loop Cells(row, column).Value = Cells(row, column).Value - k k = 0 End If Next fCell And Next Cell row = row + 1 Next ofCell
Thanks.
Use a For Next loop rather than for For Each
So more like,
For Each ofCell In Range("Order_Flavors") Row = 2 For lngindex = 1 To Range("Flavors").Rows.Count If ofCell = Range("Flavors").Cells(lngindex) Then Do Until Range("Expiration_Dates").Cells(lngindex).Value > 5 Cells(Row, Column).Value = Cells(Row, Column).Value + 1 j = j + 1 k = k + 1 Loop Cells(Row, Column).Value = Cells(Row, Column).Value - k k = 0 End If Next Row = Row + 1 Next ofCell
Appreciate Andy,
I learned something new.
I didn't know I could Index a Range like that.
Thanks again.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks