Hi i am wanting to create a macro that will search the cell in the same row but one column over for value. Here's what i go so far.
Code
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim oSht As Worksheet
Dim strSearch As String
Dim aCell As Range
Set oSht = Sheets("Statement")
strSearch = "Prior Month Premium"
Set aCell = oSht.Cells.Find(What:=strSearch, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
If strSearch = "Prior Month Premium" Then
[B] If InStr(Range(0, 1).Value = "" Then `creating error message
[/B] MsgBox "Please enter a Prior Month Premium"
Cancel = True
End If
End If
Exit Sub
Display More
End Sub