I'm trying to get VBA to look at a particular cell across several worksheets and to put up a message (or carry out another function) if the information in any of the cells is not correct. Cell Z38 can have certain text in it or it can be empty, but anything other than that it needs to tell me which sheet (Entry Form) has the different text in.
I've built the following code, but it always returns "New Team in Entry Form 1!" regardless of which form's cell Z38 I put the different wording in. (I'm only trying out 4 sheets at the moment). I've tried removing the .Value from Form (1) IF, but it makes no difference.
(There are suitable End If's after this lot too)
Any ideas please??
If ActiveWorkbook.Sheets("Entry Form (1)").Range("Z38") <> "New Team Name" Or ActiveWorkbook.Sheets("Entry Form (1)").Range("Z38") <> "" Then
MsgBox "New Team in Entry Form 1!"
ElseIf ActiveWorkbook.Sheets("Entry Form (2)").Range("Z38").Value <> "New Team Name" Or ActiveWorkbook.Sheets("Entry Form (2)").Range("Z38").Value <> "" Then
MsgBox "New Team in Entry Form 2!"
ElseIf ActiveWorkbook.Sheets("Entry Form (3)").Range("Z38").Value <> "New Team Name" Or ActiveWorkbook.Sheets("Entry Form (3)").Range("Z38").Value <> "" Then
MsgBox "New Team in Entry Form 3!"
ElseIf ActiveWorkbook.Sheets("Entry Form (4)").Range("Z38").Value <> "New Team Name" Or ActiveWorkbook.Sheets("Entry Form (4)").Range("Z38").Value <> "" Then
MsgBox "New Team in Entry Form 4!"
'If ActiveWorkbook.Sheets("Entry Form (5)").Range("Z38") = "New Team Name" Or Range("Z38") = "" Then
'If ActiveWorkbook.Sheets("Entry Form (6)").Range("Z38") = "New Team Name" Or Range("Z38") = "" Then
'If ActiveWorkbook.Sheets("Entry Form (7)").Range("Z38") = "New Team Name" Or Range("Z38") = "" Then
'If ActiveWorkbook.Sheets("Entry Form (8)").Range("Z38") = "New Team Name" Or Range("Z38") = "" Then
'If ActiveWorkbook.Sheets("Entry Form (9)").Range("Z38") = "New Team Name" Or Range("Z38") = "" Then
'If ActiveWorkbook.Sheets("Entry Form (10)").Range("Z38") = "New Team Name" Or Range("Z38") = "" Then
'MsgBox "There are no new teams"
Else
MsgBox "No New Team in here!"
Bookmarks