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

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
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,222,405
Messages
6,165,864
Members
451,988
Latest member
boo203

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