praveenlal
New Member
- Joined
- Oct 27, 2021
- Messages
- 34
- Office Version
- 2016
- Platform
- Windows
Is it possible to call Macro and then edit its variables ?
Sub Save_All_Files()
Call Account_Name_And_Year_1
Call Data_2021_1
Call Account_Name_And_Year_1
Call Data_2022_1
With Account_Name_And_Year_1
With wb
With ws
rootAccount = ws.Cells(101, 10).Value
year = ws.Cells(101, 11).Value
For Each pt In ws.PivotTables
With pt
With .PivotFields("Root Account")
.CurrentPage = rootAccount
End With
With .PivotFields("Year")
.CurrentPage = year
End With
End With
End With
Next pt
End With
Call Data_2021_1
Call Data_2022_1
End Sub
Sub Save_All_Files()
Call Account_Name_And_Year_1
Call Data_2021_1
Call Account_Name_And_Year_1
Call Data_2022_1
With Account_Name_And_Year_1
With wb
With ws
rootAccount = ws.Cells(101, 10).Value
year = ws.Cells(101, 11).Value
For Each pt In ws.PivotTables
With pt
With .PivotFields("Root Account")
.CurrentPage = rootAccount
End With
With .PivotFields("Year")
.CurrentPage = year
End With
End With
End With
Next pt
End With
Call Data_2021_1
Call Data_2022_1
End Sub