I came up with a solution that should circumvent my original issue (found below VBA code so I can keep this short and sweet if extra info is unnecessary) but I get a runtime error9. I tested this code on two basic workbooks and it worked fine. The LastRow line is the line that highlights when debugging. I tried to surround the file name in single 's since the name has spaces but that didn't resolve the error.
Sub MakeGSATable()
Dim LastRow As Long
LastRow = Workbooks("Reservation Activity Dashboard (RAD) CP.xlsm").Worksheets("GSR").Cells(Worksheets("GSR").Rows.Count, "A").End(xlUp).Row
With Workbooks("Reservation Activity Dashboard (RAD) CP.xlsm").Worksheets("GSR")
.Range("A8").Select
.Range(Selection, Selection.End(xlToRight)).Select
.Range(Selection, Selection.End(xlDown)).Select
.ListObjects.Add(xlSrcRange, Range("$A$8:$AA$" & LastRow), , xlYes).Name = _
"GSATable"
.ListObjects("GSATable").TableStyle = "TableStyleLight20"
End With
End Sub
As background: my main workbook has several macros and must be opened and kept in full screen and without the formula bar. I added a macro for workbook activate/deactivating so if users open another instance of Excel, it will work normally. One of the macros in my main book would pull up another workbook, fire the macros I need within it but at some point it gets caught up in the activate/deactivate macro, never actually finishing the macros that otherwise work without the activate/deactivate macro. So I decided to try and add this macro as I think it will be a good workaround.
Worksheets("GSR")inActiveWorkbook, so you probably need to useWorkbooks("Reservation Activity Dashboard (RAD) CP.xlsm").Worksheets("GSR")instead (when calculating.Rows.Count) - YowE3KWorkbooks("Reservation Activity Dashboard (RAD) CP.xlsm")- JohnyLSelectionandGSRworksheet. H-m-m-m... What could go wrong? - JohnyLSelectstatements will crash if "GSR" isn't the active worksheet but, as far as I can see, they are all redundant anyway and should therefore be deleted. But you should changeRange("$A$8:$AA$" & LastRow)to be.Range("$A$8:$AA$" & LastRow). - YowE3K