Automatic Insert Rows VBA

M

mathew

A Very Good Evening All,

I have a macro that runs: advanced filter/copy to another
place/unique, between two worksheets (Column A in each
worksheet being the identfier; worksheet1 is source
data,with duplicates of identifiers; worksheet2 is formula
driven from the sum of the unique identifiers in
Worksheet1)

However...I would like the macro to automatically extend
the rows in worksheet2, to accommodate the ever increasing
rows of worksheet1



Here is my specific code
worksheet1 = "Invoice Record"
worksheet2 = "General Report"

Sub CommandButton1_Click()
' Automates The General Report Population
' Takes Into Account The Insertion of Rows Into Invoice
Record
' Dim vRows As Integer
' Dim irow As Long, i As Long
Application.Interactive = False
Dim myRng As Range
Sheets("General Report").Range("A:A").ClearContents
With Sheets("Invoice Record")
Set myRng = .Range("A2", .Cells(.Rows.Count, "A").End
(xlUp))
End With
myRng.AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=Sheets("General Report").Range("A2"),
Unique:=True
With Sheets("Invoice Record")
..Range("A2:AN2").AutoFilter
End With
irow = Cells(Rows.Count, "A").End(xlUp).Offset(1,
0).Activate
Application.Interactive = True
End Sub

Any help on this for a novice would be most welocome.
Cheers
Mathew
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top