![]() |
Question about using AND or OR with If-Then statements
Windows 2k Pro
Excel 2000 What is the syntax for this situation: If a = x and b = y Then [code] End If Apparently the above doesn't work. All help appreciated. -gk- |
Question about using AND or OR with If-Then statements
Hi TBA!
Try: Sub test() If Range("A4") = 7 And Range("B4") = 4 Then Range("C4") = 11 End If End Sub Same principle would apply to Or But what is your specific problem as you seem to have it OK? -- Regards Norman Harker MVP (Excel) Sydney, Australia Excel and Word Function Lists (Classifications, Syntax and Arguments) available free to good homes. "TBA" wrote in message ... Windows 2k Pro Excel 2000 What is the syntax for this situation: If a = x and b = y Then [code] End If Apparently the above doesn't work. All help appreciated. -gk- |
Question about using AND or OR with If-Then statements
Silly me...
I had tried this If a = 5 OR 7 OR 9 Then ...... doh!! Thanks for the slap upside the head. ;) -gk- "Norman Harker" wrote in message ... Hi TBA! Try: Sub test() If Range("A4") = 7 And Range("B4") = 4 Then Range("C4") = 11 End If End Sub Same principle would apply to Or But what is your specific problem as you seem to have it OK? -- Regards Norman Harker MVP (Excel) Sydney, Australia Excel and Word Function Lists (Classifications, Syntax and Arguments) available free to good homes. "TBA" wrote in message ... Windows 2k Pro Excel 2000 What is the syntax for this situation: If a = x and b = y Then [code] End If Apparently the above doesn't work. All help appreciated. -gk- |
Question about using AND or OR with If-Then statements
As is the code sample is fine. Why do you think that it
does not work? Sub test() Dim a As Long, b As Long, x As Long, y As Long a = 5 x = 5 b = 3 y = 3 If a = x And b = y Then MsgBox "hello world!" End If End Sub -----Original Message----- Windows 2k Pro Excel 2000 What is the syntax for this situation: If a = x and b = y Then [code] End If Apparently the above doesn't work. All help appreciated. -gk- . |
All times are GMT +1. The time now is 12:22 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com