Good morning. I have embedded a macro into Workbook_Open but in doing so I am prompted with 'Else without IF' error. It highlights the 'Else' line but I am unclear what further IF statement is needed? Any advice gratefully received.
Code:
Private Sub Workbook_Open()
Dim FR
Dim answer As Integer
Dim objInfo
Dim strLDAP
Dim strFullName
Dim LR
Set objInfo = CreateObject("ADSystemInfo")
strLDAP = objInfo.UserName
Set objInfo = Nothing
strFullName = GetUserName(strLDAP)
With Sheets("1718 KPIs")
FR = .Cells(.Rows.Count, 2).End(xlUp).Row
.Cells(2, 4).AutoFilter Field:=4, Criteria1:="Monthly"
answer = MsgBox("Would you like to go directly to your KPIs?", vbYesNo + vbQuestion, "KPIs")
If answer = vbYes Then
With Sheets("1718 KPIs")
LR = .Cells(.Rows.Count, 2).End(xlUp).Row
.Cells(2, 7).AutoFilter Field:=7, Criteria1:=strFullName
Else
'do nothing
End If
End With
'MsgBox "Select 'Show my KPIs'" & vbNewLine & "Once complete select 'Submit KPIs'", vbOKOnly
End Sub