On the attached example I want to add some code to the Command Button that when pressed deletes the rows where column J has the text "No Shops".
Any ideas on how to write the code?
Cheers.
On the attached example I want to add some code to the Command Button that when pressed deletes the rows where column J has the text "No Shops".
Any ideas on how to write the code?
Cheers.
Here you go
![]()
Dim ptr As Long, LastRow As Long LastRow = Cells(Rows.CountLarge, "j").End(xlUp).Row With Application .ScreenUpdating = False For ptr = LastRow To 2 Step -1 If Cells(ptr, "j") = "No Shops" Then Cells(ptr, "j").EntireRow.Delete End If Next .ScreenUpdating = True End With
Thanks,
Mike
If you are satisfied with the solution(s) provided, please mark your thread as Solved.
Select Thread Tools-> Mark thread as Solved.
Try the below code...![]()
Private Sub CommandButton1_Click() n = Range("J65536").End(xlUp).Row For i = 1 To n If Cells(i, 10).Value = "No Shops" Then Cells(i, 10).EntireRow.Delete i = i - 1 End If Next i End Sub
Last edited by JBeaucaire; 09-14-2012 at 10:33 AM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks