Hello there !!!
Sorry I am posting all my questions here, just that I find that in this forum people are more responsive I have this code that works, but not the way I want it to. I want the loop to delete all the rows that match the cell value with the click of the button. At the moment I have to click through and they delete one by one with each click. Is there a way that it can just go over the work Sheet and delete at the same time ???
Thank youuu in advance !!!
Code
- Sub DeleteMyRows()
- Dim ws As Worksheet
- Dim LastRow As Integer
- Dim student As String
- Dim i As Integer
- Set ws = Worksheets("DataBase")
- LastRow = ws.Cells(Rows.Count, "C").End(xlUp).Row
- student = Worksheets("Summary").Cells(7, "H")
- i = 1
- Do While ws.Cells(i, 3) <> ""
- If ws.Cells(i, 3).Value = student Then
- ws.Cells(i, 3).EntireRow.Delete
- End If
- i = i + 1
- Loop
- End Sub