Hi,
I'm getting an error (else without an if) on the following if then else statement:
First it tests if the target cell is blank, if it is, then it tests if the cell three columns to the left is blank, if it is then a userform is opened. If the second tested cell isn't blank, then a msgbox opens asking to insert a new row.
I'm getting an error (else without an if) on the following if then else statement:
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal target As Range, Cancel As Boolean)
Dim Ans As Long
If target.Value = "" Then
If target.Offset(0, -3) = "" Then
usf_Main.Show
Else: Ans = MsgBox("Add new row?", vbYesNo)
End If
If Ans = vbNo Then Exit Sub
Else: target.EntireRow.Insert , copyorigin:=xlFormatFromRightOrAbove
End If
Else: usf_Adjust.Show
End If
End Sub
First it tests if the target cell is blank, if it is, then it tests if the cell three columns to the left is blank, if it is then a userform is opened. If the second tested cell isn't blank, then a msgbox opens asking to insert a new row.