Move to the first empty column

61 views Asked by At

This code searches for a string, moves to the left using Ctrl Left, and then one more to the left. that is what the offset command is for. but it gives an error. Can't figure out why. Should probably say that there are some hidden columns in the spreadsheet.

Sub delete_column()
    Cells.Find(What:="Transcript - Curriculum Title (Transcript)", After:=ActiveCell, LookIn:= _
        xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext _
        , MatchCase:=False, SearchFormat:=False).Activate
    Selection.End(xlToLeft).Select
    ActiveCell.Offset(0, -1).Select
    ActiveCell.EntireColumn.Select
    Selection.Delete Shift:=xlToLeft
End Sub
0

There are 0 answers