Update Event Macro

Mldeuser

Well-known Member
Joined
Dec 27, 2008
Messages
573
Office Version
  1. 365
Platform
  1. Windows
Hello

I need some help tp update the below macro. I need it to ask if the PA Files need to be updated, if Yes then call the macro, if No then nothing happens.

Private Sub Workbook_Open()



Call Update_PA_File()

Dim a As VbMsgBoxResult, b As String

a = MsgBox("Is it time to update the spreadsheet?", vbYesNo + vbQuestion)

If a = vbNo Then Exit Sub

b = InputBox("Enter the new date - 20th Cash Cut-Off")

Sheets("Input").Range("B6").Value = DateValue(b)

ActiveWorkbook.Protect Password:="", Structure:=True, Windows:=False

End Sub

Thank you
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Just repeat this section:

Code:
a = MsgBox("Is it time to update the spreadsheet?", vbYesNo + vbQuestion)

If a = vbNo Then Exit Sub

changing the message.
 
Upvote 0
Solution

Forum statistics

Threads
1,215,459
Messages
6,124,947
Members
449,198
Latest member
MhammadishaqKhan

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