Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Interate backward using "Step"
I want to loop backward through the cells in a sheet, but I don't know how.
My normal configuration for looping forward is as follows: Dim rngCell As Range Dim wrkSheet As ThisWorkbook.Sheets("DATA") For Each rngCell In wrkSheet.Columns(1).UsedRange.Rows .... .... Next Can someone please show me how to convert this so that it will "step" backward from the bottom of the sheet upward? Thanks much in advance. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Interate backward using "Step"
Hi Quartz,
Try something like: Sub sTester02() Dim rng As Range Dim i As Long, j As Long Dim sh As Worksheet Set sh = ThisWorkbook.Sheets('"DATA") j = Cells(Rows.Count, "A").End(xlUp).Row For i = j To 1 Step -1 '// do something, Next i End Sub --- Regards, Norman "quartz" wrote in message ... I want to loop backward through the cells in a sheet, but I don't know how. My normal configuration for looping forward is as follows: Dim rngCell As Range Dim wrkSheet As ThisWorkbook.Sheets("DATA") For Each rngCell In wrkSheet.Columns(1).UsedRange.Rows ... ... Next Can someone please show me how to convert this so that it will "step" backward from the bottom of the sheet upward? Thanks much in advance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
change "true" and "false" to "availble" and "out of stock" | Excel Worksheet Functions | |||
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next | New Users to Excel | |||
Only step through cells that are "Active" | Excel Programming | |||
"Multiple-step operation generated errors" | Excel Programming |