I am currently using a macro to search my spreadsheet for terms and if it finds them to delete the entire row.
This has worked fine up until i hit the 1024 character line limit.
I have tried using &_ as well as _ to bring continue the code on the next line and get "Compile Error: expected list separator or )"
Showing only 3 terms but it continues past 1024 characters....
SearchItems = Split("Search Term 1,Search Term 2,Search Term 2,Search Term 3", ",")
As Always Thanks In Advance!
Also here if full code.
' This macro will delete an entire row based on the presence of a
'predefined word or set of words. If that word or set of words is
'found in a cell, in a specified column, the entire row will be 'deleted
Application.ScreenUpdating = False
Dim x As Long
Dim Z As Long
Dim LastRow As Long
Dim FoundRowToDelete As Boolean
Dim OriginalCalculationMode As Long
Dim RowsToDelete As Range
Dim SearchItems() As String
Dim DataStartRow As Long
Dim SearchColumn As String
Dim SheetName As String
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Choose the row you want the search and delete to start on
' Choose the column to search and delete to use for deletion
' Choose the sheet in the workbook you want this macro to be run on
DataStartRow = 1
SearchColumn = "A"
SheetName = "Sheet1"
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Enter the terms you want to be used for criteria for deletion
' All terms entered below are CASE SENSITIVE and need to be
'seperated by a comma
SearchItems = Split("Search Term 1,Search Term 2,Search Term 2,Search Term 3", ",")
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
On Error GoTo Whoops
OriginalCalculationMode = Application.Calculation
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
With Worksheets(SheetName)
LastRow = .Cells(.rows.Count, SearchColumn).End(xlUp).Row
For x = LastRow To DataStartRow Step -1
FoundRowToDelete = False
For Z = 0 To UBound(SearchItems)
If InStr(.Cells(x, SearchColumn).Value, SearchItems(Z)) Then
FoundRowToDelete = True
Exit For
End If
Next
If FoundRowToDelete Then
If RowsToDelete Is Nothing Then
Set RowsToDelete = .Cells(x, SearchColumn)
Else
Set RowsToDelete = Union(RowsToDelete, .Cells(x, SearchColumn))
End If
If RowsToDelete.Areas.Count > 100 Then
RowsToDelete.EntireRow.Delete
Set RowsToDelete = Nothing
End If
End If
Next
End With
If Not RowsToDelete Is Nothing Then
RowsToDelete.EntireRow.Delete
End If
Whoops:
Application.Calculation = OriginalCalculationMode
Bookmarks