Hello everyone,
I hope you can help me!?
I'm trying to use VBA to copy the first 4 columns from an intelligent/smart table that has 10 or more columns into another intelligent/smart table.
The additional problem is that only the displayed rows from the table should be copied (if filters are set). I have already found out that I have to use “xlCellTypeVisible” for this.
Currently my code looks like this:
I get an Error = runtime error 9
Can you please help me with a working code? I don´t know much about vba.
Thank you and see you soon
I hope you can help me!?
I'm trying to use VBA to copy the first 4 columns from an intelligent/smart table that has 10 or more columns into another intelligent/smart table.
The additional problem is that only the displayed rows from the table should be copied (if filters are set). I have already found out that I have to use “xlCellTypeVisible” for this.
Currently my code looks like this:
VBA Code:
Option Explicit
Sub CopyData()
Worksheets(1).ListObjects("TableCom").ListColumns(2).DataBodyRange.SpecialCells(xlCellTypeVisible).Copy Destination:=Worksheets(2).ListObjects("TableColl").ListColumns(1)
End Sub
I get an Error = runtime error 9
Can you please help me with a working code? I don´t know much about vba.
Thank you and see you soon