View Single Post
  #3   Report Post  
frankjh19701 frankjh19701 is offline
Member
 
Posts: 89
Post

I want to be able to "Clear" the sheet and re-use the workbook each month. If I use Formulas instead of Macros, the formulas would be lost when I "Cleared" the sheet. I think I figured it out. I'm using a Macro to Sum a specific column and then send the value to a specific sheet/column/row.

This macro gets the information
Sub Auto_Open()
'
' Auto_Open Macro
'Sub Sorting()

Dim sh2 As Worksheet, finalrow As Long
Dim i As Long, lastrow As Long
Set sh2 = Sheets("123-Johnson")
finalrow = Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To finalrow
If Cells(i, 3).Value = "Johnson" Then
lastrow = sh2.Cells(Cells.Rows.Count, 1).End(xlUp).Row
Cells(i, 1).EntireRow.Copy Destination:=sh2.Cells(lastrow + 1, 1)

End If
Next i


This Macro gets the SUM and sends the value to another sheet

Sub Test2()
Dim LRow As Long

With Sheets("123-Johnson")
LRow = .Cells(Rows.Count, "M").End(xlUp).Row
Sheets("Monthly Totals").Range("B4") = _
WorksheetFunction.Sum(.Range("M:M"))
End With

This Macro "Clears" the sheet of the values.

Sub clearcellsonsheets()
For i = sh2 To sh79
ms = "123-Johnson" & i
Sheets("123-Johnson").Range("A2:AH100000").ClearContents
Next I

And then I repeat the process for the next month.

Thank you for you efforts.