Hi Excel Fox,
I already have one code on that sheetAnd when i add yours underneath i get the error 'Ambigious name' ggrrCode:Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim Cell As Range Dim myPassword As String myPassword = "UnknowN" For Each Cell In ActiveSheet.UsedRange On Error Resume Next MyCase = UCase(Cell) If MyCase = "TARGUS" Or MyCase = "YELLOW" Or MyCase = "RAIL" Or MyCase = "IONS" Or MyCase = "EONS" Or MyCase = "WEBSTORE" Or MyCase = "TV" Or MyCase = "CAPTIAL RENT" Or MyCase = "QUICK" Or MyCase = "LIONS" Or MyCase = "GAME" Or MyCase = "DIRECT" Or MyCase = "NEST" Or MyCase = "HELPER" Or MyCase = "OTTER" Then ' add more if needed Application.EnableEvents = False Application.Undo Application.EnableEvents = True ActiveSheet.Protect Password:=myPassword ' Password you have to change what you want MsgBox "Incorrect Entry" & vbCr & vbCr & "Please use the correct sheet", vbCritical ThisWorkbook.Close savechanges:=True End If Next End Sub




Reply With Quote
Bookmarks