Hi all,
I am having issues with figuring out how to do more than one validation.
I have files that are shared with people to use, but i am trying to limit what can be entered.
On a tab, i have one column where information is entered. what should be entered is based on a dropdown list (which i have setup on a validation). the other thing that should be allowed to be entered is a an 8 digit number. when something else is entered, i need to have a popup message appear to tell the user to fix the error.
I have no idea how to effectively enter in the restriction in VBA for this.
Below is the VBA i have started:
1. The problem is that if one of the drop-downs is chosen, then i get this error message (because the dropdown list has text that is more than 8 characters in length).
2. The one other problem is that if the cell is left blank, i still receive the popup message. how do i avoid this from showing up.
3. I am also looking to do something like this for a range of cells (from F5:F100).
does anyone have any suggestions?
thanks in advance!
-Jason
I am having issues with figuring out how to do more than one validation.
I have files that are shared with people to use, but i am trying to limit what can be entered.
On a tab, i have one column where information is entered. what should be entered is based on a dropdown list (which i have setup on a validation). the other thing that should be allowed to be entered is a an 8 digit number. when something else is entered, i need to have a popup message appear to tell the user to fix the error.
I have no idea how to effectively enter in the restriction in VBA for this.
Below is the VBA i have started:
1. The problem is that if one of the drop-downs is chosen, then i get this error message (because the dropdown list has text that is more than 8 characters in length).
2. The one other problem is that if the cell is left blank, i still receive the popup message. how do i avoid this from showing up.
3. I am also looking to do something like this for a range of cells (from F5:F100).
Code:
Private Sub Worksheet_Change()
Dim stue As String
stue = "f5"
Application.EnableEvents = True
If Len(Range("f5")) <> 8 Then
MsgBox "there is an error in cell " & stue & " "
End If
End Sub
does anyone have any suggestions?
thanks in advance!
-Jason
Last edited by a moderator: