Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
reverse cursor/text direction within cell [email protected] Excel Discussion (Misc queries) 4 August 24th 08 06:12 AM
Need Direction CmK New Users to Excel 3 July 3rd 07 12:04 AM
How do I reverse the direction of the tab key Nathan Crump New Users to Excel 2 July 11th 06 02:21 AM
I need direction Reluctantputerhead Excel Discussion (Misc queries) 3 November 2nd 05 12:42 AM
tab direction IC[_2_] Excel Programming 9 September 10th 04 02:28 PM


All times are GMT +1. The time now is 07:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"