![]() |
If ..Then statements
If you have 2 conditions (2 IF statements) and both must be met, or we go to
the 'else' statement, what is the code for this? Your help will be appreciated. -- phil in da uk |
If ..Then statements
If MyVar1 = True And MyVar2 = False Then
MsgBox "First Condition Satisified" Else MsgBox "Do Something Else" End If -- Rob van Gelder - http://www.vangelder.co.nz/excel "phil" wrote in message ... If you have 2 conditions (2 IF statements) and both must be met, or we go to the 'else' statement, what is the code for this? Your help will be appreciated. -- phil in da uk |
If ..Then statements
If i 2 and j 5 then
else End if -- Regards, Tom Ogilvy "phil" wrote in message ... If you have 2 conditions (2 IF statements) and both must be met, or we go to the 'else' statement, what is the code for this? Your help will be appreciated. -- phil in da uk |
If ..Then statements
How does this work exactly - here is my code-hopefully you can see
what I'm trying to do here. This is part of the'open' procedure. Where would I write myvar code or define myvar? Thanks for your help Sheets("MENU").Select If ActiveWorkbook.FullName = "C:\TMR\TMR.xls" Then Sheets("MENU").Select Else Sheets("End").Select Range("A1").Select MsgBox "Contact Psyfactor Ltd for Licence", vbOKOnly, "TMR" Application.ActiveWorkbook.Save Application.Quit End If If Dir("C:\WINDOWS\system32\unicode.txt") = vbNullString Then Sheets("End").Select Range("A1").Select MsgBox "Contact Psyfactor Ltd for Licence", vbOKOnly, "TMR" Application.ActiveWorkbook.Save Application.Quit End If End Sub "Rob van Gelder" wrote: If MyVar1 = True And MyVar2 = False Then MsgBox "First Condition Satisified" Else MsgBox "Do Something Else" End If -- Rob van Gelder - http://www.vangelder.co.nz/excel "phil" wrote in message ... If you have 2 conditions (2 IF statements) and both must be met, or we go to the 'else' statement, what is the code for this? Your help will be appreciated. -- phil in da uk |
If ..Then statements
I think this is what you mean
If ActiveWorkbook.FullName < "C:\TMR\TMR.xls" Or _ Dir("C:\WINDOWS\system32\unicode.txt") = vbNullString Then MsgBox "Contact Psyfactor Ltd for Licence", vbOKOnly, "TMR" Application.ActiveWorkbook.Save Application.Qui Else Sheets("MENU").Select End If But you may want to draw up a decison table for the 4 options FullName < AND Dir = Nul FullName < AND Dir < Null FullName = AND Dir = Nul FullName = AND Dir < Null to check it out -- HTH RP (remove nothere from the email address if mailing direct) "phil" wrote in message ... How does this work exactly - here is my code-hopefully you can see what I'm trying to do here. This is part of the'open' procedure. Where would I write myvar code or define myvar? Thanks for your help Sheets("MENU").Select If ActiveWorkbook.FullName = "C:\TMR\TMR.xls" Then Sheets("MENU").Select Else Sheets("End").Select Range("A1").Select MsgBox "Contact Psyfactor Ltd for Licence", vbOKOnly, "TMR" Application.ActiveWorkbook.Save Application.Quit End If If Dir("C:\WINDOWS\system32\unicode.txt") = vbNullString Then Sheets("End").Select Range("A1").Select MsgBox "Contact Psyfactor Ltd for Licence", vbOKOnly, "TMR" Application.ActiveWorkbook.Save Application.Quit End If End Sub "Rob van Gelder" wrote: If MyVar1 = True And MyVar2 = False Then MsgBox "First Condition Satisified" Else MsgBox "Do Something Else" End If -- Rob van Gelder - http://www.vangelder.co.nz/excel "phil" wrote in message ... If you have 2 conditions (2 IF statements) and both must be met, or we go to the 'else' statement, what is the code for this? Your help will be appreciated. -- phil in da uk |
All times are GMT +1. The time now is 09:45 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com