LuckyDPR
New Member
- Joined
- Aug 6, 2022
- Messages
- 12
- Office Version
- 2021
- Platform
- Windows
Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)
Dim NewRow As ListRow
Dim VarName As String
Application.EnableEvents = False
Application.ScreenUpdating = False
If Not (Application.Intersect(Target, Range("HHPTable[Model]")) Is Nothing) Then
Application.Calculation = xlCalculationManual
With Target
If Worksheets("VARSheet").Range("VARTable[Model]").Find(What:=Target.Value) Is Nothing Then
VarName = Application.InputBox("Please Input VAR Code:", "VAR Code")
Set NewRow = Worksheets("VARSheet").ListObjects("VARTable").ListRows.Add 'this statement is taking very long
With NewRow
.Range(Worksheets("VARSheet").Range("VARTable[Model]").Column) = Target.Value
.Range(Worksheets("VARSheet").Range("VARTable[Code]").Column) = VarName
End With
End If
End With
Application.Calculation = xlCalculationAutomatic
End If
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
Everything is fine and working but statement marked as bold is taking too much time, is there any other speedy work around to get the same result
Last edited by a moderator: