worksheet tabname

Trevor3007

Well-known Member
Joined
Jan 26, 2017
Messages
675
Office Version
  1. 365
Platform
  1. Windows
hi & good evening.


i have a worksheet that on a weekly basis needs the tab changed but will always have the same text after it IE

This bit changes weekly-This bit never changes

This bit changes weekly would use the info in cell D1

very much appreciate your help.

KR
Trevor3007
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Try:
Code:
ActiveSheet.Name = Range("D1") & "-This bit never changes"
 
Upvote 0
Code:
with Worksheets(1)
  .Name = .range("D1").value & "this bit never changes"
end with
 
Upvote 0
thank you. but it did not work for me
You may two replies. Which one didn't work for you?

Please post your ENTIRE VBA procedure, so we can see how you have placed it in your code.
 
Upvote 0
thank you & sorry the confusion.

I don't have any code ....my skills are via 'record macro'
 
Upvote 0
If you use this simple macro, and make sure that you are on the sheet you want to rename and run it, it should do what you want:
Code:
Sub MyRename()
    ActiveSheet.Name = Range("D1") & "-This bit never changes"
End Sub
Obviously, you will need to replace "-This bit never changes" with whatever it is that you really want in there.

If it does not do what you want, then I suspect you are leaving out some important details that we need to know about.
 
Last edited:
Upvote 0
thanks joe,

works but it keeps change sheet 1 *tab name DATA. the sheet I am using is sheet2 (tab name Input)

thank you .
 
Upvote 0
the sheet I am using is sheet2 (tab name Input)
That's the important detail you were leaving out!
That is why I said:
make sure that you are on the sheet you want to rename and run it
If you want to run it on a specific sheet that is NOT the active sheet, there are ways to do that, but we need to know those important details.
If it is always the second sheet you want to apply it to, here is one way:
Code:
Sub MyRename()
    Sheets(2).Name = Sheets(2).Range("D1") & "-This bit never changes"
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,162
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