muhleebbin
Active Member
- Joined
- Sep 30, 2017
- Messages
- 252
- Office Version
- 365
- 2019
- 2016
- 2013
- 2010
- Platform
- Windows
- MacOS
- Mobile
- Web
I have the following code that works well until someone accidentally loads incorrect data and needs to delete/clear the data
Can someone help me add either an error handling or additional code where if data in PP01 LD sheet gets deleted/cleared only range A4:D & lr gets cleared out on sheet PP01 Mod? Any worksheet change in PP01 LD triggers this code but currently when someone deletes/clears data cells A1:D3 copy the cells in A3:D3 but they're already prefilled with column headers and row 2 with a different formula set.
Thanks in advance for your assistance here!
VBA Code:
Sub Mod01()
Application.ScreenUpdating = False
Dim lr As Long
lr = Worksheets("PP01 LD").Cells(Rows.Count, "X").End(xlUp).Row ' change column reference to suit
Worksheets("PP01 Mod").Activate
Worksheets("PP01 Mod").Range("A3:D3").Select
Selection.AutoFill Destination:=Range("A3:D" & lr), Type:=xlFillDefault
Worksheets("PP01 LD").Activate
Application.ScreenUpdating = True
End Sub
Can someone help me add either an error handling or additional code where if data in PP01 LD sheet gets deleted/cleared only range A4:D & lr gets cleared out on sheet PP01 Mod? Any worksheet change in PP01 LD triggers this code but currently when someone deletes/clears data cells A1:D3 copy the cells in A3:D3 but they're already prefilled with column headers and row 2 with a different formula set.
Thanks in advance for your assistance here!