ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   do while, "and function" (https://www.excelbanter.com/excel-programming/357437-do-while-function.html)

oercim

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.


K Dales[_2_]

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.



oercim

do while, "and function"
 
It worked, thanks alot.cheers.



All times are GMT +1. The time now is 07:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com