taylrmstrng
New Member
- Joined
- Nov 6, 2020
- Messages
- 4
- Office Version
- 365
- Platform
- Windows
I have a macro that essentially does the following:
Any thoughts on how I can speed this up as I'd love to keep the custom names!
Thank ya
- moves a list of client names up one cell.
- all the calculations on the table (including arrays) are recalculated based on the new value in cell O2
- unhides all hidden rows
- hides all rows with 0 values
- saves as PDF with the name of a cell reference which updates each time
- repeat the above until the full list of clients has run through
Any thoughts on how I can speed this up as I'd love to keep the custom names!
Thank ya
VBA Code:
Application.ScreenUpdating = False
Application.EnableEvents = False
ActiveSheet.DisplayPageBreaks = False
' move all vendor names down one to update data
Sheets("Statement").Select
Range("O3:O4").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Range("O2").Select
ActiveSheet.Paste
' Show only active lines in sales
Rows("156:613").Select
Selection.EntireRow.Hidden = False
For Each cell In Range("A156:A613")
If Not IsEmpty(cell) Then
If cell.Value = 0 Then
cell.EntireRow.Hidden = True
End If
End If
Next
' Show only active lines in refunds
Rows("615:727").Select
Selection.EntireRow.Hidden = False
For Each cell In Range("N615:N727")
If Not IsEmpty(cell) Then
If cell.Value = 0 Then
cell.EntireRow.Hidden = True
End If
End If
Next
' Export as PDF and save as value in U4 ("Artist First - Month Year - Supplier")
s = Range("U4").Value
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
s, Quality:=xlQualityStandard, IncludeDocProperties _
:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
'
VBA Code:
Sub Looper()
With Sheets("Statement")
' Test Condition 1
Do Until .Range("O2") = Range("O3")
Application.Run "Save"
Loop
End With
End Sub