Hi,
In the spreadsheet I am working on, I have 2 different sets of Contacts:
Contact 1 = cells E55 (Con1) and E59 (Con2)
Contact 2 = cells E77 (Con3) and E81 (Con4)
I have code so that if all the cells are blank, then a MsgBox will pop up (thanks to ArkAdi for the assistance)
However, I need to expand this so if one of the 2 cells in each contact group (e.g. Contact 1 or Contact 2) is blank that a MsgBox will pop up giving a warning. (e.g. If Con1 <> 0, but Con2 = 0 & Con3 and Con4 =0 - MsgBox stating that Con2 is Blank)
The following code will warn if all cells are blank, but then also runs the individual cell check. Or if one of the cells isnt blank, then it will run the IsEmpty code only.
Hopefully I have explained what I need clearly enough and thank you in advance,![]()
Sub Contact_2() Dim Con1, Con2, Con3, Con4 Dim str As String Con1 = Worksheets("Registration Form").Range("E55").Value Con2 = Worksheets("Registration Form").Range("E59").Value Con3 = Worksheets("Registration Form").Range("E77").Value Con4 = Worksheets("Registration Form").Range("E81").Value If WorksheetFunction.CountA(Range("E55,E59,E77,E81")) = 0 Then MsgBox "this is a test" Else GoTo Contst: End If Contst: Con1 = Worksheets("Registration Form").Range("E55").Value If IsEmpty(Con1) Then str = "Please input the required Con1" & vbCrLf End If Con2 = Worksheets("Registration Form").Range("E59").Value If IsEmpty(Con2) Then str = str + "Please input the required Con2" & vbCrLf End If Con3 = Worksheets("Registration Form").Range("E77").Value If IsEmpty(Con3) Then str = str + "Please input the required Con3" & vbCrLf End If Con4 = Worksheets("Registration Form").Range("E81").Value If IsEmpty(Con4) Then str = str + "Please input the required Con4" & vbCrLf End If If Len(str) > 0 Then MsgBox str & " " & vbCrLf & "Once completed, submit your request again" End If Exit Sub
Chris
Bookmarks