Hi
I have put together the following VBA code from a macro that I recorded.
It works well, but I'm wondering if there's a quicker and better way of doing this:
I'm sure it's too long winded a way of doing it, but it seemed to make sense and does what I want it to...
d
I have put together the following VBA code from a macro that I recorded.
It works well, but I'm wondering if there's a quicker and better way of doing this:
Code:
Sub Statement()
Sheets("Statement").Select
Range("C10:F41").Select
Selection.ClearContents
Range("C9").Select
Sheets("Invoice Data").Select
ActiveSheet.Range("$A$1:$AE$65535").AutoFilter Field:=8, Criteria1:="Grand Total for Invoice"
ActiveSheet.Range("$A$1:$AE$65535").AutoFilter Field:=3, Criteria1:=Sheets("Statement").Range("A2").Value
ActiveSheet.Range("$A$1:$AE$65535").AutoFilter Field:=20, Criteria1:="="
Columns("C:L").Select
Selection.EntireColumn.Hidden = True
Columns("N:R").Select
Selection.EntireColumn.Hidden = True
Columns("T:AE").Select
Selection.EntireColumn.Hidden = True
Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Sheets("Statement").Select
Range("C9").Select
ActiveSheet.Paste
Sheets("Statement").Select
End Sub
I'm sure it's too long winded a way of doing it, but it seemed to make sense and does what I want it to...
d