access vba course - vba message box

Forum home » Delegate support and help forum » Microsoft VBA Training and help » access vba course - Vba Message Box

access vba course - Vba Message Box

resolvedResolved · Low Priority · Version Standard

Dimitrios has attended:
Excel Advanced course
Excel VBA Intro Intermediate course

Vba Message Box

Hello,

I would like to create a message box where it will say: "Copy yesterday's data?". If the user replies yes, then i want it to execute the macro that i have created in VBA (named Main) eitherwise do nothing. So far, my macro lloks like this:

Sub Main()

Application.ScreenUpdating = False
Prices
Weights
Values
Exit Sub

Dim reply As Integer

reply = MsgBox("Copy Yesterday's Data?", vbYesNo)
If reply = vbYes Then

Else
Resume
End If



I am not sure what to add after the THEN in order to make it run the MAIN sub. any help will be greatly appreciated.

RE: Vba Message Box

Dimitrios

After the THEN you enter the following line:

Call Main

This runs the Main macro.

Regards

Carlos

 

Training courses

 

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

VBA tip:

Add A New Sheet at the end of the Workbook

To add a new sheet at the end of the workbook you need to count the sheets in the workbook using:

Sheets.Count

Then use this value as the rank of the sheet after which you want to add the new sheet:

Sheets.Add After:=Sheets(Sheets.Count)

View all VBA hints and tips


Server loaded in 0.11 secs.