Hello all,
I am looking to make 1000+ reports based on a template. I have other sheets referencing the target city to update the data they report on.
I have a macro that saves the current workbook following the naming convention "Target #". In this case "Austin 1". I will then change the target city to Dallas and all of my other sheets will populate with data relevant to that city. Run the saving macro again and rinse and repeat. My question is, anyway I can make this process iterative? So that the target city cycles down the city column?
City # Target #
Austin 1 Austin 1
Dallas 2
Houston 3
Chicago 4
Miami 5
Phoenix 6
Save Macro
Sub save()
ActiveWorkbook.SaveAs Filename:="C:[File Path] & Range("C2").Text & Chr(32) & Range("D2").Text & ".xlsm", FileFormat:= _
xlOpenXMLWorkbookMacroEnabled, Password:=vbNullString, WriteResPassword:=vbNullString, _
ReadOnlyRecommended:=False, CreateBackup:=False
End Sub
-----------------------------------------------------
Another user recommended
Sub Test()
Application.ScreenUpdating = False
Dim city As Range
For Each city In Range("A2", Range("A" & Rows.Count).End(xlUp))
'your save code here
Next city
Application.ScreenUpdating = True
End Sub
Link to original posting (asking slightly different question)
https://www.mrexcel.com/forum/excel...mbining-do-loops-other-macros-statements.html
Thank you in advance and will greatly appreciate any help.
I am looking to make 1000+ reports based on a template. I have other sheets referencing the target city to update the data they report on.
I have a macro that saves the current workbook following the naming convention "Target #". In this case "Austin 1". I will then change the target city to Dallas and all of my other sheets will populate with data relevant to that city. Run the saving macro again and rinse and repeat. My question is, anyway I can make this process iterative? So that the target city cycles down the city column?
City # Target #
Austin 1 Austin 1
Dallas 2
Houston 3
Chicago 4
Miami 5
Phoenix 6
Save Macro
Sub save()
ActiveWorkbook.SaveAs Filename:="C:[File Path] & Range("C2").Text & Chr(32) & Range("D2").Text & ".xlsm", FileFormat:= _
xlOpenXMLWorkbookMacroEnabled, Password:=vbNullString, WriteResPassword:=vbNullString, _
ReadOnlyRecommended:=False, CreateBackup:=False
End Sub
-----------------------------------------------------
Another user recommended
Sub Test()
Application.ScreenUpdating = False
Dim city As Range
For Each city In Range("A2", Range("A" & Rows.Count).End(xlUp))
'your save code here
Next city
Application.ScreenUpdating = True
End Sub
Link to original posting (asking slightly different question)
https://www.mrexcel.com/forum/excel...mbining-do-loops-other-macros-statements.html
Thank you in advance and will greatly appreciate any help.