With Sheets("Sheet1") If Application.WorksheetFunction.CountA(.Cells) <> 0 Then lastCol = .Cells.Find(What:="*", _ After:=.Range("A1"), _ Lookat:=xlPart, _ LookIn:=xlFormulas, _ SearchOrder:=xlByColumns, _ SearchDirection:=xlPrevious, _ MatchCase:=False).Column Else lastCol = ...