I need a material record sheet which i created in Excel table, and summarize with Pivot Table (for Pivot Table refreshing after entry i use VBA Code), in Sheet i make a column which is "Approved" after approving i want that specific line will become locked (i use VBA code which work properly) but issue is that for Insert Line when i creat a code (which is also working fine)
when i insert line its show Run Time Erro-13 and if i remove "refreshing code" then other thing work,
Code is below
Private Sub Worksheet_Change(ByVal Target As Range)
ActiveWorkbook.RefreshAll
If Intersect(Target, Range("G:G")) Is Nothing Then Exit Sub
ActiveSheet.unprotect "1234"
Select Case Target.Value
Case "Approved"
Range("A" & Target.Row & ":F" & Target.Row).Locked = True
Case Else
Range("A" & Target.Row & ":F" & Target.Row).Locked = False
End Select
ActiveSheet.protect "1234"
End Sub
when i insert line its show Run Time Erro-13 and if i remove "refreshing code" then other thing work,
Code is below
Private Sub Worksheet_Change(ByVal Target As Range)
ActiveWorkbook.RefreshAll
If Intersect(Target, Range("G:G")) Is Nothing Then Exit Sub
ActiveSheet.unprotect "1234"
Select Case Target.Value
Case "Approved"
Range("A" & Target.Row & ":F" & Target.Row).Locked = True
Case Else
Range("A" & Target.Row & ":F" & Target.Row).Locked = False
End Select
ActiveSheet.protect "1234"
End Sub