I have a model that performs an automatic hide of a formular bar depending on what cells you pick (password entering cells and so on). There is a function that does this:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Selection.Count = 1 Then
If Not Intersect(Target, Range("Tauthcod")) Is Nothing Then
Application.DisplayFormulaBar = False
Else
Application.DisplayFormulaBar = True
End If
End If
End Sub
The model works and no problem. However when I send the file to someone else and that person tries to enable editing, i get the runtime error 91 saying "Object Variable or With block variable not set". When you debug, the second line (1st IF statement) gets highlighted.
Any quick and permanent fixes? ... silver-bullet anyone?
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Selection.Count = 1 Then
If Not Intersect(Target, Range("Tauthcod")) Is Nothing Then
Application.DisplayFormulaBar = False
Else
Application.DisplayFormulaBar = True
End If
End If
End Sub
The model works and no problem. However when I send the file to someone else and that person tries to enable editing, i get the runtime error 91 saying "Object Variable or With block variable not set". When you debug, the second line (1st IF statement) gets highlighted.
Any quick and permanent fixes? ... silver-bullet anyone?