I'm trying to debug some code and I think the problem area is related to an ElseIf statement. The error message I get is: "Compile error: Else without If" and the row that is highlighed in the Visual Basic viewer is the ElseIf Line. Any help would be appreciated.
'This is option A to add hyperlink automatically. When "Cable Assy..." in column k dropdownn is selected then
<!-- BEGIN TEMPLATE: bbcode_html -->
'This is option A to add hyperlink automatically. When "Cable Assy..." in column k dropdownn is selected then
HTML:
'a hyperlink is automatically created which links to the next blank cell A on the Cable Matrix Worksheet.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Rws As Long, sh As Worksheet
Set sh = Worksheets("CABLE_MATRIX")
With sh
Rws = .Cells(Rows.Count, "A").End(xlUp).Row + 1
End With
If Target.Count = 1 And Target.Column = 11 Then
If InStr(Target, "Cable Assy") <> 0 Then
ActiveSheet.Hyperlinks.Add Anchor:=Target.Offset(0, 5), Address:="", SubAddress:= _
"CABLE_MATRIX!A" & Rws, TextToDisplay:="CABLE_MATRIX!A" & Rws
End If
End If
' CHECK FOR NEXT CONDITION. Automatic date when an entry is made in Cell A, Q, and S.
For Each Cell In Target
If Cell.Column = 1 Then Cell.Offset(0, 11) = Date
ElseIf Cell.Column = 17 Or Cell.Column = 19 Then
Cell.Offset(0, 1) = Date
End If
Next Cell
End Sub