Ironman
Well-known Member
- Joined
- Jan 31, 2004
- Messages
- 1,069
- Office Version
- 365
- Platform
- Windows
Hi
Joe4 recently very kindly provided this code for me:
I've been trying to amend this code so that it triggers a message box on each of the above 2 events i.e.
Event 1: When the value of A is greater than 28,489 and less than 28,506 and then greater than 29,489 and less than 29,506 and then greater than 30,489 and less than 30,506 and so on i.e. every increase in value being 1,000.
Event 2: When the value of A is greater than 28,504 and less than 28,516 and then greater than 29,504 and less than 29,516 and then greater than 30,504 and less than 30,516 so on - again, every increase in value being 1,000
I'm having problems getting the right format and so I'd be grateful for the solution.
Many thanks!
Joe4 recently very kindly provided this code for me:
VBA Code:
Dim A As Integer
Dim ttl As String
A = Sheets("Address Tracking").Range("M25").Value Mod 1000
ttl = Format(Application.WorksheetFunction.RoundUp(Sheets("Address Tracking").Range("M25"), -3), "#,##0") & " Miles from Current Home Address Countdown"
'Event 1
If 1000 - A <= 17 Then MsgBox 1000 - A & " miles to go until you reach " & Format(Sheets("Address Tracking").Range("M25").Value + 1000 - A, "#,##0") & " miles", vbInformation, ttl
'Event 2
If A > 0 And A <= 10 Then MsgBox "Congratulations! You have now run over " & Format(Sheets("Address Tracking").Range("M25").Value + 1000 - A, "#,##0") & " miles from this address", vbInformation, "Another 1,000 Miles Run From This Address"
I've been trying to amend this code so that it triggers a message box on each of the above 2 events i.e.
Event 1: When the value of A is greater than 28,489 and less than 28,506 and then greater than 29,489 and less than 29,506 and then greater than 30,489 and less than 30,506 and so on i.e. every increase in value being 1,000.
Event 2: When the value of A is greater than 28,504 and less than 28,516 and then greater than 29,504 and less than 29,516 and then greater than 30,504 and less than 30,516 so on - again, every increase in value being 1,000
I'm having problems getting the right format and so I'd be grateful for the solution.
Many thanks!