dpaton05
Well-known Member
- Joined
- Aug 14, 2018
- Messages
- 2,352
- Office Version
- 365
- 2016
- Platform
- Windows
I don't know what each line of this code does. Can someone add a comment for each line so I can update it please?
VBA Code:
Sub Transfer()
Dim ws As Worksheet, sh As Worksheet, sht As Worksheet
Set sh = Sheets("Totals")
Set sht = Sheets("Cancellations")
Dim Req As String: Req = sh.[B25].Value
Dim Dt As String: Dt = sh.[B27].Value
Application.ScreenUpdating = False
For Each ws In Worksheets
If ws.Name <> "Cancellations" And ws.Name <> "Totals" Then
With ws.[A3].CurrentRegion
.AutoFilter 1, Dt
.AutoFilter 3, Req
.Offset(1).EntireRow.Copy sht.Range("A" & Rows.Count).End(3)(2)
.Offset(1).EntireRow.Delete
.AutoFilter
End With
End If
Next ws
sh.Range("B25,B27").ClearContents
Application.ScreenUpdating = True
End Sub