VBA Error Handling

ItalianPlatinum

Well-known Member
Joined
Mar 23, 2017
Messages
793
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I thought this would be an easy find but I am actually having trouble finding a way to accomplish this. I am looking for a way pop a warning message if someone ran the VBA sub already. Essentially I have a file and only want my PRE work run once only and if a user tries to run it a second time I want an error message to display to sort of slow them down like are you sure you want to run this it was already run. I couldnt find anything via google searches. Someone able to help?
 
The only modification was if it does meet I do want the user to have the ability to still proceed.
 
Upvote 0

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
You could do something like this:
VBA Code:
Dim chk
If Int(Range("Z1")) = Date Then
    chk = MsgBox("You already ran this today, do you still want to continue?", vbYesNo)
    If chk = vbNo Then
        Exit Sub
    End If
End If
If they click "No" it will exit the sub, otherwise it will continue.
 
Upvote 0
Solution

Forum statistics

Threads
1,215,377
Messages
6,124,598
Members
449,174
Latest member
chandan4057

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