Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default 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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default 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

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
IF statement syntax Sander Excel Discussion (Misc queries) 4 July 14th 09 06:04 PM
if statement syntax help OfficeManager Excel Worksheet Functions 6 July 23rd 08 08:09 PM
need help with syntax of if statement Melody Excel Worksheet Functions 3 February 15th 08 05:05 PM
when writing an IF statement what is the syntax for "Not Equal to. NEEDTOKNOW Excel Discussion (Misc queries) 1 December 10th 04 04:32 PM


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