VBA Tab Names

RMM4487

New Member
Joined
Jun 6, 2017
Messages
8
Hey guys,

I'm fairly new to VBA but progressing daily. I usually can dig up solutions to issues with a quick search on here but I haven't seem to come up with a solution to my current problem. Here's the deal:

I currently am building an automated financial model; the model creates a new tab and pulls in data from another book; nothing revolutionary here. However, the problem I'm having is using VBA to rename the tab. The reason is because I need the name of sheet to be a specific value and format. The tab needs to be renamed "MIAC" + today's date, formatted as "D.MM" with the separator literally being "." . For example today's tab would be named "MIAC 7.26". I set up a formula in Excel to display the date formatted with MIAC in front however, I have tried having VBA directly copy the cell with custom formatting to display the date as MIAC + Date, I've tried setting a variable as that cell and setting the sheet name to that variable, and directly setting the sheet name to that cell however in all instances I lose the format and my tab name ends up being just the date code (i.e. 49233 etc.)

Any work around for this?

Thanks !

Ryan
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Hi RMM4487 - If I understand your quest correctly you might try the code below. Hope this helps.

Code:
Sub RMM4487_tab_name()
Dim BuildTheTabName As String
Month1 = Month(Now())
Day1 = Day(Now())

BuildTheTabName = "MIAC" & " " & Month1 & "." & Day1

    ActiveSheet.Name = BuildTheTabName
End Sub
 
Upvote 0
Hia
how about
Code:
    ActiveSheet.Name = "MIAC " & Day(Date) & "." & Month(Date)
 
Upvote 0
Glad we could help
Thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,021
Latest member
Justyna P

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