I have code below, which I need amended to only delete the columns on all sheets containing YTD in row 1
the code is deleting all the columns except the columns containing YTD in row 1
Sub YTD_Text()
Dim ws As Worksheet, x
For Each ws In Worksheets
x = ws.Range("c1").Resize(, ws.Cells.SpecialCells(11).Column).Address(0, 0)
x = Filter(ws.Evaluate("if(iserror(search(""ytd""," & x & ")),address(1,column(" & x & "),4))"), False, 0)
If UBound(x) > -1 Then ws.Range(Join(x, ",")).EntireColumn.Delete
Next
End Sub
it would be appreciated if someone could kindly assist me
Bookmarks