Hi there, below is the code I have in the excel file. Basically what it does it starts with one tab full of data, creates 3 new tabs, and then filter/copy/paste information from the original data set to each of the 3 new tabs based upon different attributes. It also adds a new "date" column to the original data set.
I am pretty new to VBA and made this macro with mostly online searches and the record function. I'm curious to see if there are more advanced ways write this code so the file runs faster, doesn't take up as much space, and doesn't constantly crash
Thank you!
I am pretty new to VBA and made this macro with mostly online searches and the record function. I'm curious to see if there are more advanced ways write this code so the file runs faster, doesn't take up as much space, and doesn't constantly crash
Thank you!
Code:
[FONT='inherit']Public Sub sing_off_formatting()[/FONT]
<code style="font-family: "Courier New", courier, monospace; margin: 0px 2px; padding: 15px; border: 0px; background-color: transparent; border-radius: 2px; word-break: normal; display: block; font-size: 1em; line-height: 16px; overflow: auto;"> Selection.CurrentRegion.Select
Selection.Columns.AutoFit
Selection.Rows.AutoFit
'Creates tabs for each of the desired reports
Sheets.Add(After:=Sheets(Sheets.Count)).Name = "Prepared Screens"
Sheets.Add(After:=Sheets(Sheets.Count)).Name = "Senior Reviewed"
Sheets.Add(After:=Sheets(Sheets.Count)).Name = "Manager Reviewed"
'Creates a column that only has a date for reference
Sheets("sing off analysis macro").Activate
Columns("O:O").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("O1").Select
ActiveCell.FormulaR1C1 = "Prepared Date"
Range("O2").Select
ActiveCell.FormulaR1C1 = "=RIGHT(RC[1],9)"
Range("O2").Select
Selection.AutoFill Destination:=Range("O2:O999")
Columns("O:O").Select
Selection.NumberFormat = "m/d/yyyy"
'Creates report with screens that are prepared and not reviewed and highlights screens prepared last month
Sheets("sing off analysis macro").Activate
Sheets("sing off analysis macro").Cells.Select
ActiveSheet.Range("$A$1:$U$352").AutoFilter Field:=3, Criteria1:="Prepared"
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Copy
Sheets("Prepared Screens").Activate
ActiveSheet.Paste
Selection.Columns.AutoFit
Selection.Rows.AutoFit
'creates report with screens that are reviewed by only the senior and highlights screens prepared last month
Sheets("sing off analysis macro").Activate
Range("C1").Select
ActiveSheet.ShowAllData
ActiveSheet.Range("$A$1:$T$352").AutoFilter Field:=13, Criteria1:= _
"XXXXXXX, Timothy"
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Copy
Sheets("Senior Reviewed").Activate
ActiveSheet.Paste
Selection.Columns.AutoFit
Selection.Rows.AutoFit
Range("E1").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$T$7").AutoFilter Field:=7, Criteria1:="="
'creates report with screens that are reviewed by only the manager and highlights screens prepared last month
Sheets("sing off analysis macro").Activate
Range("C1").Select
ActiveSheet.ShowAllData
ActiveSheet.Range("$A$1:$T$352").AutoFilter Field:=13, Criteria1:= _
"XXXXX, Scott"
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Copy
Sheets("Manager Reviewed").Activate
ActiveSheet.Paste
Selection.Columns.AutoFit
Selection.Rows.AutoFit
Range("E1").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$T$7").AutoFilter Field:=5, Criteria1:="="
End Sub</code>
Last edited by a moderator: