Try this
Code:Sub HowardsClearRoutine() Const FirstRowToClear = 4 Const FirstColumnToClear = "A" Const LastColumnToClear = "D" Const TotalColumn = "A" Dim LastRowToClear As Integer Dim RangeToClear As String Dim LocationOfTotal As Range Dim lngLOop As Long ' Find the row where the word "Total" is in column A, and clear the contents of rows ' FirstRowToClear through LastRowToClear for columns FirstColumnToClear thru LastColumnToClear For lngLOop = 1 To ThisWorkbook.Sheets.Count - 2 Set Sht = ThisWorkbook.Sheets(lngLOop) Set LocationOfTotal = Sht.Columns(TotalColumn).Find("Total") ' Last row to clear is the row BEFORE the Total LastRowToClear = LocationOfTotal.Row - 1 ' Now construct the range which we will be clearing RangeToClear = FirstColumnToClear + Format(FirstRowToClear) RangeToClear = RangeToClear + ":" RangeToClear = RangeToClear + LastColumnToClear + Format(LastRowToClear) ' Do we want to clear the contents, or delete the cells? This example simply clears the contents Sht.Range(RangeToClear).ClearContents RangeToClear = "" Next Sht End Sub




Reply With Quote
Bookmarks