PDA

View Full Version : adding a message box icon



keilah
04-02-2008, 06:41 AM
Hi experts

How would i add a message box icon to the following code....

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If ActiveCell.Value = "" Then
MsgBox ("Invalid Data Input Attempt - Error")
End If

End Sub

need the user to see a STOP and red cross in a circle with the above message......once the message box is displayed and the user click ok to acknownledge the message......he/she still cannot go back and try to enter any data in all balnk/empty cells.....

thanks

keilah
04-02-2008, 07:11 AM
fixed the problem - the first part......but still cannot stop user from entering data into balank/empty cells.

Bob Phillips
04-02-2008, 07:13 AM
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If ActiveCell.Value = "" Then
MsgBox "Invalid Data Input Attempt - Error", vbCritical + vbOKOnly
End If
End Sub

keilah
04-02-2008, 07:14 AM
XLD

how do you do the second part ....... no data input at ALL - have no idea

Bob Phillips
04-02-2008, 07:45 AM
Protect the worksheet.

keilah
04-02-2008, 07:50 AM
but i have loads of data entry point in the worksheet that are already protected i was look at the VBA option.....adding code to what i already have....

Bob Phillips
04-02-2008, 07:56 AM
So change all cells to locked and add the protection.. And I do mean do it in VBA, far simpler than checking each cell in VBA.