Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Reverse Direction of For-Each-Next?
Hi All - part of the code I'm working on has something like: ' _______________________________ For Each XYZ In Range (Cells(topaddressrow, topaddresscolumn) Cells(bottomaddressrow, bottomaddresscolumn)) My_Var = bla.....gather, sum, combine etc what I'm getting.... bla. Next Range("X5").Value = My_Var ' _______________________________ The contents of My_Var is always the result of the code working fro the top of the range downward to the bottom of the range. It does no matter which way I define the range. My question is: Is there a way to make the For Each statemen work/return data from the bottom up? Thanks for any help! FuzzyDov -- FuzzyDov ----------------------------------------------------------------------- FuzzyDove's Profile: http://www.excelforum.com/member.php...fo&userid=1667 View this thread: http://www.excelforum.com/showthread.php?threadid=31991 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Reverse Direction of For-Each-Next?
For Counter = Start to Finish *Step -1* Next Counte -- crispb ----------------------------------------------------------------------- crispbd's Profile: http://www.excelforum.com/member.php...fo&userid=1088 View this thread: http://www.excelforum.com/showthread.php?threadid=31991 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Reverse Direction of For-Each-Next?
For ranges it can be done like this:
Sub test() Dim ABC As Range Dim XYZ As Range Dim L As Long Set ABC = Range(Cells(1, 1), Cells(3, 3)) For L = ABC.Count To 1 Step -1 Set XYZ = ABC(L) MsgBox XYZ.Address Next End Sub HTH. Best wishes Harald "FuzzyDove" skrev i melding ... Hi All - part of the code I'm working on has something like: ' _______________________________ For Each XYZ In Range (Cells(topaddressrow, topaddresscolumn), Cells(bottomaddressrow, bottomaddresscolumn)) My_Var = bla.....gather, sum, combine etc what I'm getting.... bla. Next Range("X5").Value = My_Var ' _______________________________ The contents of My_Var is always the result of the code working from the top of the range downward to the bottom of the range. It does not matter which way I define the range. My question is: Is there a way to make the For Each statement work/return data from the bottom up? Thanks for any help! FuzzyDove -- FuzzyDove ------------------------------------------------------------------------ FuzzyDove's Profile: http://www.excelforum.com/member.php...o&userid=16676 View this thread: http://www.excelforum.com/showthread...hreadid=319919 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
reverse cursor/text direction within cell | Excel Discussion (Misc queries) | |||
Need Direction | New Users to Excel | |||
How do I reverse the direction of the tab key | New Users to Excel | |||
I need direction | Excel Discussion (Misc queries) | |||
tab direction | Excel Programming |