Patriot2879
Well-known Member
- Joined
- Feb 1, 2018
- Messages
- 1,259
- Office Version
- 2010
- Platform
- Windows
Hi i have the code below but i keep getting a runtime error 91 object variable or with block variable not set, please can you hellp with this it highlights in yellow when i click on debug the .Formula = TheFormula code which is below in the whole code, any advise would be great and thanks
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Rng As Range
Static Cell As Range
Static TheFormula As String
Set Rng = Range("N2:V192")
If Not Application.Intersect(Target, Rng) Is Nothing Then
If Not Cell Is Nothing Then
Cell.Formula = TheFormula
End If
Set Cell = ActiveCell
With Cell
TheFormula = .Formula
.Value = .Value
End With
Else
With Cell
.Formula = TheFormula
End With
End If
End Sub