ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Syntax for multiple if statement (https://www.excelbanter.com/excel-programming/347239-syntax-multiple-if-statement.html)

Andyroo

Syntax for multiple if statement
 
I keep tripping over with the following code. I have tried many variations
of it in my macro and they all fail:

If Range("B22") 0 And Range("A35") - Range("B22") = 3 Then
Range("A22").Select

The code sticks on the first line, so my If statement must be incorrectly
written somehow.

Any help gratefully received.

Ron Rosenfeld

Syntax for multiple if statement
 
On Sat, 3 Dec 2005 14:39:02 -0800, "AndyRoo"
wrote:

I keep tripping over with the following code. I have tried many variations
of it in my macro and they all fail:

If Range("B22") 0 And Range("A35") - Range("B22") = 3 Then
Range("A22").Select

The code sticks on the first line, so my If statement must be incorrectly
written somehow.

Any help gratefully received.


Sub foo()

If Range("B22") 0 And Range("A35") - Range("B22") = 3 Then
Range("A22").Select
End If

End Sub

Works fine here. There must be something else going on in your routines that
is not apparent from what you've posted.



--ron

Andyroo

Syntax for multiple if statement
 
OK, thanks. I'll have another look at the rest of my macro.

"Ron Rosenfeld" wrote:

On Sat, 3 Dec 2005 14:39:02 -0800, "AndyRoo"
wrote:

I keep tripping over with the following code. I have tried many variations
of it in my macro and they all fail:

If Range("B22") 0 And Range("A35") - Range("B22") = 3 Then
Range("A22").Select

The code sticks on the first line, so my If statement must be incorrectly
written somehow.

Any help gratefully received.


Sub foo()

If Range("B22") 0 And Range("A35") - Range("B22") = 3 Then
Range("A22").Select
End If

End Sub

Works fine here. There must be something else going on in your routines that
is not apparent from what you've posted.



--ron



All times are GMT +1. The time now is 11:06 PM.

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