Hi
I am quite new in VBA.
I have two Excel Tables and I need to copy rows in table1 that meets a criteria on Table1 and paste them to the bottom of table2.
I've tried many ways to do that without succes.
The code I'm trying to run:
Dim tabela As ListObject
Dim newrow As ListRow
ActiveWorkbook.Sheets("Compra").ListObjects("Compra").Range.AutoFilter Field:=7, Criteria1:=">0"
ActiveSheet.ListObjects("Compra").DataBodyRange.SpecialCells(xlCellTypeVisible).Copy
Set tabela = Worksheets("Histórico").ListObjects("BaseHst")
Set newrow = tabela.ListRows.Add
newrow.Range(1).PasteSpecial xlPasteValues
If ActiveWorkbook.Sheets("Compra").FilterMode = True Then
ActiveWorkbook.Sheets("Compra").ListObjects("Compra").Range.AutoFilter
End If
End Sub
A new line is inserted at the bottom os the secon table and I get a meeesge about the failure of the Paste in Range method.
Any comment will be welcome.
Thank in advance
Bookmarks