Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi - I'm almost there! For some reason, the loop I wrote stops before it
should (it should stop when variable x = variable z). Can someone take a look and let me know if they think they know why? The loop starts half way down -- I put in the code for the whole Macro as it may help you understand what I'm doing here. Any help is appreciated!! Sub Macro1() ' ' Macro1 Macro ' Macro recorded 1/23/2005 by Cisco Systems, Inc. ' ' Dim x As Range Dim y As Range Dim z As Range Dim Myrange As Range Worksheets("Aurora").Activate Range("A1").Select Cells.Find(What:="MAX PRICE AFTER ADJUSTMENTS:", After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).Activate Set x = ActiveWindow.RangeSelection Set y = ActiveCell.Offset(0, 1) Set z = ActiveCell.Offset(0, 1) ActiveCell.Offset(1, 1).Range("A1").Select Range(Selection, Selection.End(xlDown)).Select Range(Selection, Selection.End(xlToRight)).Select Set Myrange = ActiveWindow.RangeSelection For Each c In Myrange c.Value = c.Value / 500 Next Do While x < z y.Select Cells.Find(What:="MAX PRICE AFTER ADJUSTMENTS:", After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).Activate Set z = ActiveWindow.RangeSelection Set y = ActiveCell.Offset(0, 1) ActiveCell.Offset(1, 1).Range("A1").Select Range(Selection, Selection.End(xlDown)).Select Range(Selection, Selection.End(xlToRight)).Select Set Myrange = ActiveWindow.RangeSelection For Each c In Myrange c.Value = c.Value / 500 Next Loop End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "Linking to specific cells in pivot table" crosoft.com wrote in message ... : Hi - I'm almost there! For some reason, the loop I wrote stops before it : should (it should stop when variable x = variable z). Can someone take a : look and let me know if they think they know why? The loop starts half way : down -- I put in the code for the whole Macro as it may help you understand : what I'm doing here. Any help is appreciated!! : <snip: : Do While x < z have you tried Do Until x = z did you verify what x and z were when the loop ended? Paul D |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Paul. How do I verify what x and z are when the loop ends?
"PaulD" wrote: "Linking to specific cells in pivot table" crosoft.com wrote in message ... : Hi - I'm almost there! For some reason, the loop I wrote stops before it : should (it should stop when variable x = variable z). Can someone take a : look and let me know if they think they know why? The loop starts half way : down -- I put in the code for the whole Macro as it may help you understand : what I'm doing here. Any help is appreciated!! : <snip: : Do While x < z have you tried Do Until x = z did you verify what x and z were when the loop ended? Paul D |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "Linking to specific cells in pivot table" crosoft.com wrote in message ... : Thanks Paul. How do I verify what x and z are when the loop ends? : one way is to use a breakpoint at the end of the loop then look at the value for each Paul D |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel Macro loop problems | Excel Discussion (Misc queries) | |||
for next loop problems | Excel Programming | |||
Loop code problems | Excel Programming | |||
If... Then Loop problems in Worksheet Event | Excel Programming | |||
Can I have a loop to open a set of workbooks get some data, close it one a time. | Excel Programming |