Hello,
I am attempting to automate Custom Views on a form.
Everytime I run it, I get Compile Error: Else without If, but I cannot seem to find the issue.
My first guess was that the issue was the indentation. I tried using Smart Indenter but it still produces the same error.
I am completely uncertain how to proceed and searching forums has not produced useful guidance.
I am attempting to automate Custom Views on a form.
VBA Code:
Sub CustomViews()
'
' Designed to make the custom views automated
'
If Sh1.Range("G4") = "All Products + Metered" Then ActiveWorkbook.CustomViews("All Products + Metered").Show
ElseIf Sh1.Range("G4") = "All Products Non-Metered" Then ActiveWorkbook.CustomViews("All Products Non-Metered").Show
ElseIf Sh1.Range("G4") = "Bill Pay + S2" Then ActiveWorkbook.CustomViews("Bill Pay + S2").Show
ElseIf Sh1.Range("G4") = "Bill Pay Only" Then ActiveWorkbook.CustomViews("Bill Pay Only").Show
ElseIf Sh1.Range("G4") = "Billing + Submetered" Then ActiveWorkbook.CustomViews("Billing + Submetered").Show
ElseIf Sh1.Range("G4") = "Billing Non Submetered" Then ActiveWorkbook.CustomViews("Billing Non Submetered").Show
ElseIf Sh1.Range("G4") = "Billing + Submetered & Bill Pay" Then ActiveWorkbook.CustomViews("Billing + Submetered").Show
ElseIf Sh1.Range("G4") = "Billing + Non Submetered & Bill Pay" Then ActiveWorkbook.CustomViews("Billing Non Submetered").Show
Else: ActiveWorkbook.CustomViews("All Products + Metered").Show
End If
'
End Sub
My first guess was that the issue was the indentation. I tried using Smart Indenter but it still produces the same error.
I am completely uncertain how to proceed and searching forums has not produced useful guidance.