Ironman
Well-known Member
- Joined
- Jan 31, 2004
- Messages
- 1,069
- Office Version
- 365
- Platform
- Windows
Hi
I have the following code:
With Worksheets("Daily Tracking")
MsgBox "You have now run " & MlsYTDLessLastYr & "miles " & _
If(MlsYTDLessLastYr < 0, "less", "more") & _
" than this time last year ", vbInformation, "Mileage Compared To This Time Last Year"
End If
End With
What I am looking for is for Excel to look at the named range (which is a single cell with a value, either negative or positive). If it's negative or positive I want to use the word "less" or "more".
Right now, Excel is ignoring the third row completely and the msg is "You have now run miles than this time last year" and no error msg instead of "You have now run X miles less or more than this time last year".
What would be even better is if the value was 0 then the msg would say "You have run the same miles as this time last year".
I guess this is a simple fix but I can't understand where I'm going wrong.
Please help!
Many thanks!
I have the following code:
With Worksheets("Daily Tracking")
MsgBox "You have now run " & MlsYTDLessLastYr & "miles " & _
If(MlsYTDLessLastYr < 0, "less", "more") & _
" than this time last year ", vbInformation, "Mileage Compared To This Time Last Year"
End If
End With
What I am looking for is for Excel to look at the named range (which is a single cell with a value, either negative or positive). If it's negative or positive I want to use the word "less" or "more".
Right now, Excel is ignoring the third row completely and the msg is "You have now run miles than this time last year" and no error msg instead of "You have now run X miles less or more than this time last year".
What would be even better is if the value was 0 then the msg would say "You have run the same miles as this time last year".
I guess this is a simple fix but I can't understand where I'm going wrong.
Please help!
Many thanks!
Last edited: