Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default do while, "and function"

Hello, I have a problem. In excel macro I have to use a "do
while loop". I have two conditions to pass the loop. I made a code as
below,

d1=2
d2=5
r1=0,
Do While and(r1 =0, d1 < d2)
.....
.....
.....
loop


but it gives an syntax error message at the "do while" line.
I guess I am using "and function" improperly. Thanks.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default do while, "and function"

There is a difference between how to do AND conditions in VBA from the way
you would do them in a worksheet function; the VBA syntax is:
Do While (r1 =0) And (d1 < d2)
--
- K Dales


"oercim" wrote:

Hello, I have a problem. In excel macro I have to use a "do
while loop". I have two conditions to pass the loop. I made a code as
below,

d1=2
d2=5
r1=0,
Do While and(r1 =0, d1 < d2)
.....
.....
.....
loop


but it gives an syntax error message at the "do while" line.
I guess I am using "and function" improperly. Thanks.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default do while, "and function"

It worked, thanks alot.cheers.

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
Text "comparison" operator for "contains" used in an "IF" Function Pawaso Excel Worksheet Functions 4 April 4th 23 11:35 AM
Excel 2003: Conditional Formatting using "MIN" & "MAX" function MMangen Excel Discussion (Misc queries) 2 September 16th 08 07:13 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
inserting a conditional "go to" command on a excel "if" function velasques Excel Worksheet Functions 5 March 10th 06 08:16 PM
Please add a "sheet" function like "row" and "column" functions Spreadsheet Monkey Excel Programming 2 November 8th 05 04:08 PM


All times are GMT +1. The time now is 12:10 PM.

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"