pop up message

keffw

New Member
Joined
Oct 13, 2002
Messages
1
i need to know if there is way to create a pop up message for a cell to warn user from entering information into that cell. but it still needs to be able to accept information by the user with authority to do so. like if they clicked on a cell and then a message gave a warning do not enter.
 

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.

DonkeyOte

MrExcel MVP
Joined
Sep 6, 2002
Messages
9,123
Not sure about a pop up box (though you may be able to use an on activate) - but you can use "data validation" to create a box that will appear when that cell is active...
 

Tom Urtis

MrExcel MVP
Joined
Feb 10, 2002
Messages
11,257
It sounds like you only want some users (the ones with authorization) to access the cell, and all others to stay out.

If so, try this. Right click on your sheet tab, left click on View Tab, and paste in the code below. It is two event procedures, one for when the cell is selected, and one for when the cell is changed.

Modify the code for password and target cell (A1 is used in this example).

If this is what you are looking for, then the next obvious step is to protect the VBE from snoopers, to stop them from getting into the sheet code to learn the password. But first let's see if this code is what you want:



Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address <> "$A$1" Then Exit Sub
Dim WarnPass As String
WarnPass = InputBox(prompt:="You just selected cell " & Target.Address & ", which is a special cell." & vbCrLf & vbCrLf & _
"If you did this by mistake, or if you" & vbCrLf & _
"don't even know what I'm talking about," & vbCrLf & _
"then hit the OK or Cancel button to escape," & vbCrLf & _
"no harm no foul, it's all good." & vbCrLf & vbCrLf & _
"Otherwise, enter your password below" & vbCrLf & _
"in order to enter or edit data in this cell:", _
Title:="Your password is required to access cell " & Target.Address & ".")
If WarnPass <> "Password" Then
MsgBox "Click OK to return to to the worksheet.", _
16, "Cancelled -- correct password not entered."
ActiveSheet.Unprotect ("Password")
ActiveCell.Locked = True
ActiveSheet.Protect ("Password")
Else
ActiveSheet.Unprotect ("Password")
ActiveCell.Locked = False
ActiveSheet.Protect ("Password")
End If
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address <> "$A$1" Then Exit Sub
ActiveSheet.Unprotect ("Password")
ActiveCell.Locked = True
ActiveSheet.Protect ("Password")
End Sub
_________________
 

Forum statistics

Threads
1,144,328
Messages
5,723,730
Members
422,512
Latest member
MHau5

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
Top