title: How to Exclude a Specific Row from a Find Last Column Function
body: <p>I've created a spreadsheet that creates an inventory list. The Macro i'm writing opens my intranets search page, enters the catalog number in row a (not shown in image). and returns information to the excel sheet. As it enters locations (RIG), It creates a header in row 2. I created a second macro that removes inactive locations. After this filter, I'm left with a cleaner list, but I want to remove the header in row 2 that no longer has information below it (i.e. columns AH, AI, AJ and so on). I know I can find the last used column of the worksheet, but what i want to do is clear formatting , border and contents in row2 whenever row3 to lastrow is empty.</p>
  
  <p>Is there a way to adjust this to exclude the row2 from the search?</p>
  
  <pre><code>Dim LastColumn As Integer
  
  Set LastColumn = Cells.Find(What:="*", After:=[A1], _
  SearchOrder:=xlByColumns, _ 
  SearchDirection:=xlPrevious).Column
  
  Cells(2,LastColumn).Select
  ActiveCell.Offset(0,1)
   Do
   If not ActiveCell = "" Then
    ActiveCell.EntireColumn.Delete(xlToLeft)
    DoEvents
   Else
    Exit Do
   End If
   Loop
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/G0MqH.jpg" alt="My Search SHeet"></p>
  
  <p><strong>Final Code after incorporating Gary's Students Response. Thank you!!</strong></p>
  
  <pre><code> 'Find last used column below header row
  Dim wf As WorksheetFunction
  Dim N As Long
  Dim rCol As Range
  
  Set wf = Application.WorksheetFunction
  Cells(1, 1).EntireRow.Hidden = True
  Cells(2, 1).EntireRow.Hidden = True
  
  Do
  For N = Columns.Count To 1 Step -1
      Set rCol = Cells(1, N).EntireColumn
      If wf.Subtotal(103, rCol) &gt; 0 Then
          Exit Do
      End If
  Next
  Loop
  
  Cells(1, 1).EntireRow.Hidden = False
  Cells(2, 1).EntireRow.Hidden = False
  
   'Trim header row to used columns only
  Cells(2, N).Select
  ActiveCell.Offset(0, 1).Select
  
   Do
      If Not ActiveCell = "" Then
          ActiveCell.EntireColumn.Delete (xlToLeft)
          DoEvents
      Else
          Exit Do
      End If
  Loop
  </code></pre>