LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default 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
 
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
Excel Macro loop problems mibsaweiss Excel Discussion (Misc queries) 0 March 16th 06 04:45 PM
for next loop problems cliee Excel Programming 3 November 1st 04 12:05 PM
Loop code problems pauluk[_51_] Excel Programming 2 April 23rd 04 10:30 AM
If... Then Loop problems in Worksheet Event TB[_3_] Excel Programming 2 August 4th 03 08:45 AM
Can I have a loop to open a set of workbooks get some data, close it one a time. wellie Excel Programming 2 July 9th 03 04:58 AM


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

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

About Us

"It's about Microsoft Excel"