I have a file with some datas and want to required a VBA code working to meet the following needs:-
Please refer the attach file for more clarifications.
1-Delete all rows having code '201596' from the column Inv. Pty i.e.Column C.Refer range C1184 to C1197.
2-Sorting according to 'time' i.e. column K.
Also please mention that if more codes to be delete in future,then, can it be easily process or not?
Automatic delete vendor code and sorting to time
-
- 3StarLounger
- Posts: 354
- Joined: 27 Oct 2013, 15:11
- Location: Gurgaon INDIA
Automatic delete vendor code and sorting to time
Regards
Pradeep Kumar Gupta
INDIA
Pradeep Kumar Gupta
INDIA
-
- Administrator
- Posts: 78629
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Automatic delete vendor code and sorting to time
First, delete the empty row 3. Then run this macro:
If you want to delete multiple codes, change Array("201596") to for example Array("201596", "219349", "100505"), listing all code that you want to delete.
Code: Select all
Sub DeleteRowsAndSort()
Application.ScreenUpdating = False
Range("B3").CurrentRegion.AutoFilter Field:=2, Criteria1:=Array("201596"), _
Operator:=xlFilterValues
Range("B3").CurrentRegion.Offset(1).EntireRow.Delete
Range("B3").CurrentRegion.AutoFilter
Range("B3").CurrentRegion.Sort Key1:=Range("K3"), Header:=xlYes
Application.ScreenUpdating = True
End Sub
Best wishes,
Hans
Hans
-
- 3StarLounger
- Posts: 354
- Joined: 27 Oct 2013, 15:11
- Location: Gurgaon INDIA
Re: Automatic delete vendor code and sorting to time
Thank you Hans sir.Codes are running fine as expected.Glad.
Regards
Pradeep Kumar Gupta
INDIA
Pradeep Kumar Gupta
INDIA