Rename Sheets According to Cell Info with Message Box ( VBA )

Please_H

Board Regular
Joined
Apr 16, 2017
Messages
181
Office Version
  1. 2019
Platform
  1. Windows
Dear All,

Hope everyone of you all are Safe and Sound with your Families.

I am in need of Renaming certain Sheets of my Worksheet depending some cell info (I have attached the sample worksheet I am working with)

What I have :

01.
Sheet Name "Report Ops" does have 2 Cells, F3 is to Type and F5 has a formula.
> F3 requests a user to enter a date they might wish to work with,
> F5 picks the 1st Day of the respective Year.

02. Sheet Name "BASE" does have 2 Ranges, C3:C12 and D3:D12.
> IF,F3 <> F5, C3:C12 gives digits of a Financial Year Time Period, ex : 20-21, 21-22, 22-23 etc.
> IF,F3 = F5, D3:D12 gives digits of a Calendar Year Time Period, ex : 2020, 2021, 2022 etc.

03. 10 Sheets Named as ; FY 01, FY 02....up to FY 10 .

What I Need :

01.
When a Date is entered in F3 a message Box stating, "Please press LAUNCH to adjust Sheet Names" with a 'Launch' button to run the Macro.
02. Then if F3 <> F5, it re-names sheet FY 01, FY 02....up to FY 10 as found in >> Sheet "Base" C3:C12
03.
Then if F3 = F5, it re-names sheet FY 01, FY 02....up to FY 10 as found in >> Sheet "Base" D3:D12
04.
Once the Macro is Run Once the Sheet names will be changed, so when a new Date is entered again, I should be able to rename the sheets again accordingly.

Is this even possible? :unsure:

The Sheet Link is found below,

wip Test Audit Forecast (xxxx) 20xx
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Dear All,

I did manage to find a work-around for my issue through this code below,

VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Set Target = Range("A1")
If Target = "" Then Exit Sub
Application.ActiveSheet.Name = VBA.Left(Target, 31)
Exit Sub
End Sub

This did help me to add an 'IF' Formula and get me to rename sheets without a message Box or Run the VBA. It seems to work fine as a Dynamic VBA.

But there seem to be a catch,
Unless I come to this respective sheet and click on a cell, the Sheet name doesn't appear to change.
Can anyone tell me why and if that can be fixed?
Something tells me "Active Sheet Name" part is the Culprit in here...:confused:
 
Upvote 0

Forum statistics

Threads
1,215,011
Messages
6,122,677
Members
449,092
Latest member
tayo4dgacorbanget

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top