I am trying to write a code that loop through to hide worksheet tab automatically if certain name exists then add column with vlookup. If none of this names exists do nothing. if I didn't manually comment the . I am trying to hide if it exist (Michael , Jami , Stam, Christina) if they exist I want to hide them if none of those names exist do nothing in the code, It is giving me an error.
Sub Admin_Auto_Add()
Dim rec_range As String
Dim wb As Workbook
Dim lookup_reference As String
With Original
ActiveWorkbook.Sheets("Michael").Visible = xlSheetHidden
ActiveWorkbook.Sheets("Jami").Visible = xlSheetHidden
' ActiveWorkbook.Sheets("Stam").Visible = xlSheetHidden
ActiveWorkbook.Sheets("Christina").Visible = xlSheetHidden
Columns("C:C").Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("C1").Value = "Admin_Vlookup"
rec_range = getColRangeFunction("Admin_Vlookup")
Range(rec_range).Formula = "=VLOOKUP(B2,'[Pairing List.xlsx]Recruiting_Admins'!$A$1:$B$32, 2,0)"
Range(rec_range).Select
End With
End Sub