Forum Discussion
macedosf
Mar 02, 2020Copper Contributor
Deleting specific row after entering data in another specific cell
Hello guys. I need some help in order to create a macro which enable user to delete the entire row 4 after entering data in cell A9 in a control spreadsheet My goal is to keep the last five ...
Riny_van_Eekelen
Mar 03, 2020Platinum Contributor
macedosf Inspired by the information in this link:
https://docs.microsoft.com/en-us/office/troubleshoot/excel/run-macro-cells-change
You could adapt the code like this:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim KeyCell As Range
Set KeyCell = Range("A9")
If Not Application.Intersect(KeyCell, Range(Target.Address)) _
Is Nothing Then
Rows("4:4").Select
Selection.Delete Shift:=xlUp
End If
End Sub....and place it in the in the code section for the worksheet (i.e. not in a separate module).
- macedosfMar 04, 2020Copper ContributorHi,
Thank you for supporting me on Thais matter.
Best Regards!!