I am trying to produce some VBA code that will look for my column that contains the column header "New query" in the first cell for row 1. It should then delete all rows where the substring value '' is present in each cell for the column.
This is what I have come up with:
Set rng = Rows("1:1").Find(what:="New query", after:=Cells(1, 1), LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext)
With Intersect(Sheets("Sheet1")
.Columns(rng.EntireColumn.Address))
.Replace "''", "#N/A", xlPart
.SpecialCells(xlConstants, xlErrors).EntireRow.Delete
End With
With Intersect(Sheets("Sheet1").UsedRange, rng.EntireColumn)
. Might also have problems if your cells contain just two single quotes. Is this imported from elsewhere? – SJR