Linking to specific cells in p
Guest
So close! Problems with Loop
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
Bookmarks