Hi, I'm trying to format data in an Excel file using a macro-enabled workbook and I'm getting an error 1004 The worksheet data for a table needs to be on the same sheet as the table. I'm not sure where it is the location is being changed in this code. Thanks so much!
VBA Code:
Private Sub workbook_open()
Dim src As Range
Dim ws As Worksheet
Application.DisplayAlerts = False
Workbooks.Open Filename:= _
"C:\Merge Data Sources\callforsubmissions tab.xlsx"
Set src = Range("A1").CurrentRegion
Set ws = ActiveSheet
ws.ListObjects.Add(SourceType:=xlSrcRange, Source:=src, _
xlListObjectHasHeaders:=xlYes, _
tablestyleName:="TableStyleMedium28").Name = "Table1"
ActiveWorkbook.SaveAs Filename:= _
"C:\Users\jjones\McDow\Devo Team - General\Call for submissions data file\callforsubmissions tab.xlsx" _
, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
ActiveWindow.Close
Application.DisplayAlerts = True
End Sub