I have a command button macro that is set up. in it i call a Sub from the workbook. When i run the macro by itself, it works just fine. The command button works just fine by itself as well, but once they are combined it ends up giving me an error. "Run-time error '9': Subscript out of range" the thing that really confuses me is, this will go away sometimes if i restart excel or it will go away if i restart my entire computer. now as you may guess, im not fond of this time waste and would like any help or advice on why this may be happening!
The command button
Sheets(Array("Sales Snapshot", "Agent Rejections", _
"Agent Estimate Lost Profit", "CPS Links")).Copy
Call saveUniversal <--- the macro that gets called
ActiveSheet.PivotTables("PivotTable5").ChangePivotCache ActiveWorkbook. _
PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _ etc etc etc
The save macro
Sub saveUniversal() <--- the macro that is getting called
Dim FName As String
Dim FPath As String
Dim wbBook1 As Workbook
Set wbBook1 = ActiveWorkbook
FPath = "T:\Client Services\Cancellation Wheels\Weekly Data\Quill\"
FName = wbBook1.Sheets("CPS Links").Range("A4").Text <--- this is where the iusse is. it sometimes works fine sometimes it doesnt.
wbBook1.SaveAs Filename:=FPath & "\" & FName
End Sub
thank you for your help,
Jaxs
The command button
Sheets(Array("Sales Snapshot", "Agent Rejections", _
"Agent Estimate Lost Profit", "CPS Links")).Copy
Call saveUniversal <--- the macro that gets called
ActiveSheet.PivotTables("PivotTable5").ChangePivotCache ActiveWorkbook. _
PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _ etc etc etc
The save macro
Sub saveUniversal() <--- the macro that is getting called
Dim FName As String
Dim FPath As String
Dim wbBook1 As Workbook
Set wbBook1 = ActiveWorkbook
FPath = "T:\Client Services\Cancellation Wheels\Weekly Data\Quill\"
FName = wbBook1.Sheets("CPS Links").Range("A4").Text <--- this is where the iusse is. it sometimes works fine sometimes it doesnt.
wbBook1.SaveAs Filename:=FPath & "\" & FName
End Sub
thank you for your help,
Jaxs