Hi All
I am currently trying to run a macro on individual sheets to change the name of the sheet to the value in A1 of the same sheet. The code I am using is
Sub myTabName()
ActiveSheet.Name = ActiveSheet.Range("A1")
End Sub
Which works perfectly on individual sheets.
However I want to set up a button to run this on the applicable sheets (31 in total) so I have created a run all macro.
Sub RunAll()
Call Sheet10.myTabName
Call Sheet11.myTabName
Call Sheet12.myTabName
Call Sheet13.myTabName
Call Sheet14.myTabName
Call Sheet15.myTabName
Call Sheet16.myTabName
Call Sheet17.myTabName
Call Sheet18.myTabName
Call Sheet19.myTabName
Call Sheet20.myTabName
Call Sheet21.myTabName
Call Sheet22.myTabName
Call Sheet23.myTabName
Call Sheet24.myTabName
Call Sheet25.myTabName
Call Sheet26.myTabName
Call Sheet27.myTabName
Call Sheet28.myTabName
Call Sheet29.myTabName
Call Sheet30.myTabName
Call Sheet31.myTabName
Call Sheet4.myTabName
Call Sheet46.myTabName
Call Sheet47.myTabName
Call Sheet49.myTabName
Call Sheet50.myTabName
Call Sheet51.myTabName
Call Sheet7.myTabName
Call Sheet8.myTabName
Call Sheet9.myTabName
End Sub
At this point it only runs on the sheet I am on and not other other sheets. I am really new to VBA and am learning as I go along so please forgive me if I'm being stupid!
The eventual outcome will be to attach the run all macro to a button to make it easy for all to use.
Any help or advice would be welcome. Thank you!
I am currently trying to run a macro on individual sheets to change the name of the sheet to the value in A1 of the same sheet. The code I am using is
Sub myTabName()
ActiveSheet.Name = ActiveSheet.Range("A1")
End Sub
Which works perfectly on individual sheets.
However I want to set up a button to run this on the applicable sheets (31 in total) so I have created a run all macro.
Sub RunAll()
Call Sheet10.myTabName
Call Sheet11.myTabName
Call Sheet12.myTabName
Call Sheet13.myTabName
Call Sheet14.myTabName
Call Sheet15.myTabName
Call Sheet16.myTabName
Call Sheet17.myTabName
Call Sheet18.myTabName
Call Sheet19.myTabName
Call Sheet20.myTabName
Call Sheet21.myTabName
Call Sheet22.myTabName
Call Sheet23.myTabName
Call Sheet24.myTabName
Call Sheet25.myTabName
Call Sheet26.myTabName
Call Sheet27.myTabName
Call Sheet28.myTabName
Call Sheet29.myTabName
Call Sheet30.myTabName
Call Sheet31.myTabName
Call Sheet4.myTabName
Call Sheet46.myTabName
Call Sheet47.myTabName
Call Sheet49.myTabName
Call Sheet50.myTabName
Call Sheet51.myTabName
Call Sheet7.myTabName
Call Sheet8.myTabName
Call Sheet9.myTabName
End Sub
At this point it only runs on the sheet I am on and not other other sheets. I am really new to VBA and am learning as I go along so please forgive me if I'm being stupid!
The eventual outcome will be to attach the run all macro to a button to make it easy for all to use.
Any help or advice would be welcome. Thank you!