Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 216
Default Loop macro for a Newbie

I would like to be able to move to a specific page in my
spreadsheet when a condition is met. I need this to work
in one of my existing macros.

ie

When cell(15,8)=0
go to
Sheets("view").Select

otherwise
ActiveSheet.Calculate

Loop back.

How can one write a simple loop program?


Thanks and Happy new year.

Mike

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Loop macro for a Newbie

sub WaitforAValue()
If Activesheet.Name = "Sheet1" then
do
if ActiveSheet.Cells(15,8) = 0 then
Worksheets("View").Activate
exit sub
Else
ActiveSheet.Calculate
end if
DoEvents
Loop while true
End If
End Sub

if cells(15,8) is a formula that calculate a floating point number, then it
may never equal zero. You would need a test like

if Abs(Activesheet.Cells(15,8).Value) < .0001 then

I assume there is something in your worksheet that would cause the value of
cells(15,8) to change on a calculate.

--
Regards,
Tom Ogilvy


--
Regards,
Tom Ogilvy


"mike" wrote in message
...
I would like to be able to move to a specific page in my
spreadsheet when a condition is met. I need this to work
in one of my existing macros.

ie

When cell(15,8)=0
go to
Sheets("view").Select

otherwise
ActiveSheet.Calculate

Loop back.

How can one write a simple loop program?


Thanks and Happy new year.

Mike



  #4   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Loop macro for a Newbie

thanks. that works great

-----Original Message-----
sub WaitforAValue()
If Activesheet.Name = "Sheet1" then
do
if ActiveSheet.Cells(15,8) = 0 then
Worksheets("View").Activate
exit sub
Else
ActiveSheet.Calculate
end if
DoEvents
Loop while true
End If
End Sub

if cells(15,8) is a formula that calculate a floating

point number, then it
may never equal zero. You would need a test like

if Abs(Activesheet.Cells(15,8).Value) < .0001 then

I assume there is something in your worksheet that would

cause the value of
cells(15,8) to change on a calculate.

--
Regards,
Tom Ogilvy


--
Regards,
Tom Ogilvy


"mike" wrote in

message
...
I would like to be able to move to a specific page in

my
spreadsheet when a condition is met. I need this to

work
in one of my existing macros.

ie

When cell(15,8)=0
go to
Sheets("view").Select

otherwise
ActiveSheet.Calculate

Loop back.

How can one write a simple loop program?


Thanks and Happy new year.

Mike



.

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
VBA Newbie: Help with Do Loop code Carl Excel Discussion (Misc queries) 3 December 2nd 04 07:04 PM
Macro Help for Newbie Phil Excel Programming 2 October 15th 03 04:57 AM
newbie: stop a FOR NEXT loop Mike H[_7_] Excel Programming 4 October 11th 03 04:47 PM
Newbie. Please help me find a loop solution Nigel Brown[_3_] Excel Programming 1 July 16th 03 02:48 PM
Newbie. Please help me find a loop solution Nigel Brown[_2_] Excel Programming 0 July 16th 03 10:25 AM


All times are GMT +1. The time now is 01:15 PM.

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"