I am having trouble with an 'IF' instruction within a Macro. My system at work is Windows XP Pro SP2 and Office 2003 SP3.
I have written the following macro to check whether 2 cells have been updated and to report if either have not but to switch to a new spreadsheet if both have been changed:
Sub Order()
'
' Order Macro
' Macro recorded 23/06/2008 by Stmcar
'
If A1 = 0 Then MsgBox "WARNING - you have not provided a teacher name - cannot proceed" Else _
If A2 = 0 Then MsgBox "WARNING - you have not provided a Course - cannot proceed" Else _
Sheets("Order").Select
End Sub
No matter what value I have in A1 or B1, the macro reads the contents of these fields as '0' so that as it stands I always get the message "WARNING - you have not provided a teacher name - cannot proceed"
but if I modify the first line to
If A1 <> 0 Then MsgBox "WARNING - you have not provided a teacher name - cannot proceed" Else _
I then get the message "WARNING - you have not provided a Course - cannot proceed".
I have tried modifications like using cell naming, using alha characters, and cell comparisons i.e.
If Namecheck = 0 Then MsgBox "WARNING etc or If A1 = B1 Then MsgBox "WARNING
but it just seems as it the 'IF' part is always returning 'True' whatever I do.