Hello all,
What i would like to do is delete all entire rows from C bottom to around C14 that don't contain a certain number 55555.
I rigged something up that gets it's data from another worksheet, which is a converted SQL report file and all of the queries are stacked in that worksheet in 4 columns but i need to spread them to different sheets and i need to do this every week, so adding a button to delete unnecessary information is the best option(All queries have a certain serial number).
I've tried different scripts but they don't seem to work.
What i got right now is but that gives error 1004 and i need to implement so it wont delete first 13 rows of data which are important.
Thanks
What i would like to do is delete all entire rows from C bottom to around C14 that don't contain a certain number 55555.
I rigged something up that gets it's data from another worksheet, which is a converted SQL report file and all of the queries are stacked in that worksheet in 4 columns but i need to spread them to different sheets and i need to do this every week, so adding a button to delete unnecessary information is the best option(All queries have a certain serial number).
I've tried different scripts but they don't seem to work.
What i got right now is but that gives error 1004 and i need to implement so it wont delete first 13 rows of data which are important.
Thanks
Code:
Sub Tester()
Dim sKeep As String, x As Long
Dim rngSearch As Range, c As Range
'C1:C5 has values to keep
sKeep = Chr(0) & Join(Application.Transpose(Range("C13:C16").Value), _
Chr(0)) & Chr(0)
Set rngSearch = Range("C1:C2000")
For x = rngSearch.Cells.Count To 1 Step -1
Set c = rngSearch.Cells(x)
If InStr(sKeep, Chr(0) & c.Value & Chr(0)) = 0 Then
c.Delete shift:=xlShiftUp
End If
Next x
End Sub