Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loop a range from bottom up
If I use something like
for each c in range() next c the loop will start from the first cell down. How can I loop from bottom up? Here is the scenario: 1/1/2006 ... ... ... 3/31/3006 3/31/2006 3/31/2006 I need the address of the last occurance of 3/31/2006, so I can count all records from 1/1 to 3/31. If I only loop from top down, the first occurance of 3/31 isn't want I want. I will use the start cell address (1/1/2006) and end cell address (3/31/2006) in another function. Thanks in advance. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loop a range from bottom up
test in kolumn A
Sub tst() For r = 1 To 100 If Cells(r, 1) = DateSerial(2006, 1, 31) Then x = Cells(r, 1).Address Next MsgBox ("") & x End Sub "Who I Am" skrev: If I use something like for each c in range() next c the loop will start from the first cell down. How can I loop from bottom up? Here is the scenario: 1/1/2006 ... ... ... 3/31/3006 3/31/2006 3/31/2006 I need the address of the last occurance of 3/31/2006, so I can count all records from 1/1 to 3/31. If I only loop from top down, the first occurance of 3/31 isn't want I want. I will use the start cell address (1/1/2006) and end cell address (3/31/2006) in another function. Thanks in advance. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loop a range from bottom up
ups
If Cells(r, 1) = DateSerial(2006, 3, 31) Then x = Cells(r, 1).Address "excelent" skrev: test in kolumn A Sub tst() For r = 1 To 100 If Cells(r, 1) = DateSerial(2006, 1, 31) Then x = Cells(r, 1).Address Next MsgBox ("") & x End Sub "Who I Am" skrev: If I use something like for each c in range() next c the loop will start from the first cell down. How can I loop from bottom up? Here is the scenario: 1/1/2006 ... ... ... 3/31/3006 3/31/2006 3/31/2006 I need the address of the last occurance of 3/31/2006, so I can count all records from 1/1 to 3/31. If I only loop from top down, the first occurance of 3/31 isn't want I want. I will use the start cell address (1/1/2006) and end cell address (3/31/2006) in another function. Thanks in advance. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loop a range from bottom up
For iRow = LastRow To FirstRow Step -1
Debug.Print Cells(iRow, "A") Next iRow "Who I Am" wrote: If I use something like for each c in range() next c the loop will start from the first cell down. How can I loop from bottom up? Here is the scenario: 1/1/2006 ... ... ... 3/31/3006 3/31/2006 3/31/2006 I need the address of the last occurance of 3/31/2006, so I can count all records from 1/1 to 3/31. If I only loop from top down, the first occurance of 3/31 isn't want I want. I will use the start cell address (1/1/2006) and end cell address (3/31/2006) in another function. Thanks in advance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Adding in row at bottom of range | Excel Programming | |||
starting from bottom of range instead of top | Excel Programming | |||
how use range to bottom of filled cells? | Excel Worksheet Functions | |||
Copying formula to the bottom of a range | Excel Programming | |||
How to: Add blank row at bottom of range | Excel Programming |