I have a workbook with filtered Table. What I want to do is to open another workbook, look if there is any data there and if not copy the data from the table, paste it there and close that book.
I have the below code which i am trying but just not coming right, could anybody please try help? I keep getting subscript out of range error.
Sub Macro1()
'
' Macro1 Macro
Dim ws As Worksheet, csv As Workbook, cCount As Long, cName As String
Dim wb1 As Excel.Workbook
Set wb1 = Workbooks.Open("C:\Users\matroux\Documents\TTC\TTC.xlsx")
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Set csv = ActiveWorkbook
cName = csv.Name
csv.ActiveSheet.ListObjects("Table1").Range.Copy
wb1.Activate
If wb1.Range("A2") = "" Then
ActiveSheet.Range("A1").PasteSpecial Paste:=xlPasteFormulasAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Else
End If
csv.Close
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub