VBA message amendment when result is less than 2

Ironman

Well-known Member
Joined
Jan 31, 2004
Messages
1,069
Office Version
  1. 365
Platform
  1. Windows
Hi

The below code is perfect when the result is 2 or more, but looks clumsy when it's only 1.
VBA Code:
MsgBox Format(Date, "dddd d mmmm, yyyy") & ":" & vbNewLine & vbNewLine _
         & "If you're going for a run today, then before this run:" & vbNewLine & vbNewLine _
         & "- You were " & CLng(Range("MilesToNextYearEndTotal")) & " miles behind the " & Range("PreYear") & " year end total" & vbNewLine & vbNewLine _
         & "- You were " & CLng(Abs(.Value)) & " miles behind the " & Year(Now) - 1 & " year to date total", vbInformation, "Miles Run YTD"
I'd be really grateful for an amendment to the above that changes the message from "miles" to "mile" when the value of CLng(Range("MilesToNextYearEndTotal")) or CLng(Abs(.Value)) is 1.

Many thanks!
 
Ahh, I didn't spot that. That's brilliant GWteB, it works perfectly now, thank you!
 
Upvote 0

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,215,140
Messages
6,123,269
Members
449,093
Latest member
Vincent Khandagale

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top