Msgbox with date

verluc

Well-known Member
Joined
Mar 1, 2002
Messages
1,451
I want at the beginning of a macro in sheet2 a Msgbox with the date of B10 in sheet1, and with the buttons O.K. (go further) and
Cancel (exit sub)
Can someone give me a little help?
Many thnaks in advance
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Try:
Code:
If MsgBox(Format(Sheets("Sheet1").Range("B10"), "dd/mm/yyyy"), vbOKCancel) = vbCancel Then Exit Sub
 
Upvote 0
Verluc,

Try like ......

Code:
If MsgBox(Sheets("Sheet1").Range("B10"), vbOKCancel) = vbCancel Then Exit Sub
'otherwise do this....
MsgBox "Doing some other stuff..."

Hope that helps.
 
Last edited:
Upvote 0
Tony, your code is working very fine, but I want to add the following text in the msgbox : Last working day is :
Thanks for your time.
 
Upvote 0
Code:
If MsgBox("Last working day is : " & Sheets("Sheet1").Range("B10"), vbOKCancel) = vbCancel Then Exit Sub
'otherwise do this....
MsgBox "Doing some other stuff..."
 
Upvote 0
I was starting to feel a little unloved by this thread ;) so thank you Tony. Although I really should have tested if format() was really needed.
 
Upvote 0

Forum statistics

Threads
1,215,519
Messages
6,125,298
Members
449,218
Latest member
Excel Master

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