Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,670
Default How to do the coding on UNTIL loop?

Does anyone have any suggestions on how to do the coding on Macro?

[Loop for Until]
[Perform following code]

Workbooks.Open Filename:="C:\1.xls", UpdateLinks:=3
Workbooks("1.xls").Close savechanges:=True

Until 'C:\[Data.xls]Sheet1'!$A$1 0
[Exit Until Loop]

Thank for any suggestions
Eric
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default How to do the coding on UNTIL loop?

Eric,

Generally the format for a do loop is as follows

Sub sonic()
Do
Cells(1, 1).Value = Int((12 * Rnd) + 1)
Loop While Cells(1, 1).Value < 10
End Sub

This simple loop writes a random number to A1 every loop and the loop exits
when A1 = 10. All pretty pointless but a demonstration of how it works.

Mike
"Eric" wrote:

Does anyone have any suggestions on how to do the coding on Macro?

[Loop for Until]
[Perform following code]

Workbooks.Open Filename:="C:\1.xls", UpdateLinks:=3
Workbooks("1.xls").Close savechanges:=True

Until 'C:\[Data.xls]Sheet1'!$A$1 0
[Exit Until Loop]

Thank for any suggestions
Eric

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,670
Default How to do the coding on UNTIL loop?

Thank everyone for suggestions

My requirement is to open the file at least once, if the value from
'C:\[Data.xls]Sheet1'!$A$1 0, then re-open the file again, there is the
reason for this loop.
If I apply your code to my case, it shows as below,
Am I right?

Sub Eric()
Do
Workbooks.Open Filename:="C:\1.xls", UpdateLinks:=3
Workbooks("1.xls").Close savechanges:=True
Loop While 'C:\[Data.xls]Sheet1'!$A$1 0
End Sub


"Mike H" wrote:

Eric,

Generally the format for a do loop is as follows

Sub sonic()
Do
Cells(1, 1).Value = Int((12 * Rnd) + 1)
Loop While Cells(1, 1).Value < 10
End Sub

This simple loop writes a random number to A1 every loop and the loop exits
when A1 = 10. All pretty pointless but a demonstration of how it works.

Mike
"Eric" wrote:

Does anyone have any suggestions on how to do the coding on Macro?

[Loop for Until]
[Perform following code]

Workbooks.Open Filename:="C:\1.xls", UpdateLinks:=3
Workbooks("1.xls").Close savechanges:=True

Until 'C:\[Data.xls]Sheet1'!$A$1 0
[Exit Until Loop]

Thank for any suggestions
Eric

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
coding with several arguments vinnie123 Excel Worksheet Functions 1 December 28th 06 05:41 AM
coding maisy1 Excel Discussion (Misc queries) 1 August 6th 06 08:58 PM
Coding metaltecks Excel Discussion (Misc queries) 1 April 17th 06 10:12 PM
Coding for header jesmin Excel Discussion (Misc queries) 1 December 20th 05 04:03 PM
coding Hardy Excel Discussion (Misc queries) 1 February 22nd 05 04:58 PM


All times are GMT +1. The time now is 09:43 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"