bradyman97
Board Regular
- Joined
- Feb 22, 2008
- Messages
- 60
- Office Version
- 2019
I have a sheet called Invoices below are the name of the columns. How can I extract data from columns E, G, K, L, D with criteria from column A and column B. Everytime I extract the data I need it go at the end of the previous data extracted. If it helps I have this advanced filtered VBA code below but it doesn't put it at the end of the previous month. Any help would be greatly appreciated.
A - Month/Year
B - Location
C - Vendor
D - PO #
E - PO Date
F - Line #
G - Vendor Item #
H - Description
I - Pack Description
J - Purchase Unit
K - Quantity
L - Price
M - Ext Amount
N - Notes
Sub Copy_Warehouse_Invoices() 'Module7
Dim rg As Range
Set rg = ThisWorkbook.Worksheets("Warehouse_Invoices").Range("A7").CurrentRegion
rg.Offset(1).ClearContents
Dim rgInvoices As Range, rgCriteria As Range, rgWarehouse_Invoices As Range
Set rgInvoices = ThisWorkbook.Worksheets("Invoices").Range("A1").CurrentRegion
Set rgCriteria = ThisWorkbook.Worksheets("Warehouse_Invoices").Range("A1").CurrentRegion
Set rgWarehouse_Invoices = ThisWorkbook.Worksheets("Warehouse_Invoices").Range("A7").CurrentRegion
rgInvoices.AdvancedFilter xlFilterCopy, rgCriteria, rgWarehouse_Invoices
Range("A7").CurrentRegion.Sort _
key1:=Range("B7"), order1:=xlAscending, _
key2:=Range("A7"), order2:=xlAscending, Header:=xlYes
Columns("A:E").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
With Selection.Font
.Name = "Arial"
.Size = 9
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
Range("G7").Select
End Sub
A - Month/Year
B - Location
C - Vendor
D - PO #
E - PO Date
F - Line #
G - Vendor Item #
H - Description
I - Pack Description
J - Purchase Unit
K - Quantity
L - Price
M - Ext Amount
N - Notes
Sub Copy_Warehouse_Invoices() 'Module7
Dim rg As Range
Set rg = ThisWorkbook.Worksheets("Warehouse_Invoices").Range("A7").CurrentRegion
rg.Offset(1).ClearContents
Dim rgInvoices As Range, rgCriteria As Range, rgWarehouse_Invoices As Range
Set rgInvoices = ThisWorkbook.Worksheets("Invoices").Range("A1").CurrentRegion
Set rgCriteria = ThisWorkbook.Worksheets("Warehouse_Invoices").Range("A1").CurrentRegion
Set rgWarehouse_Invoices = ThisWorkbook.Worksheets("Warehouse_Invoices").Range("A7").CurrentRegion
rgInvoices.AdvancedFilter xlFilterCopy, rgCriteria, rgWarehouse_Invoices
Range("A7").CurrentRegion.Sort _
key1:=Range("B7"), order1:=xlAscending, _
key2:=Range("A7"), order2:=xlAscending, Header:=xlYes
Columns("A:E").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
With Selection.Font
.Name = "Arial"
.Size = 9
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
Range("G7").Select
End Sub