VBA warning box

carefreeant

New Member
Joined
Feb 13, 2018
Messages
10
Hi all,

Bear with me - I am a VBA novice so any help would be appreciated.

We currently have a workbook which has a lot of tabs at the bottom. One of the tabs is called 'Shortcuts'.

I am trying to write a VBA whereby if cell P43 on the 'Shortcuts' tab contains "1" a warning pop-up appears when we open the sheet.

Could anybody help with this please? I have searched through quite a few articles online but cannot quite get the box to work correctly.
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Re: VBA warning box - help

Ok I have managed to sort the above issue, however I now have 1 further question.

The warning box appears. Is there a way of changing this so that when I click 'ok' the message does not appear again until I next open the workbook? At the moment, the message keeps popping up every time I click into another cell.
 
Upvote 0
Re: VBA warning box - help

Put this into the VBE for your Shortcuts sheet;

Code:
Private Sub Worksheet_Activate()
If Range("P43").Value = 1 Then MsgBox "Uh, there is a 1 in P43 :-/"
End Sub
 
Upvote 0
Re: VBA warning box - help

Paste the following into the ThisWorkbook module:

Code:
Private Sub Workbook_Open()

If Sheets("Shortcuts").Range("P43") = 1 Then MsgBox "Uh oh!", vbCritical
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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