Help with Renaming Tab

KiloHotel

New Member
Joined
Feb 4, 2018
Messages
42
Office Version
  1. 2016
Platform
  1. Windows
  2. MacOS
Hey Guys,

I want to rename tabs based on 2 seperate cell values,

I have the macro for renaming based on the one cell value but i can't figure out how to add another cell value on top so that both values are used in the renaming of the tab. I need to use the cell C2 value and A3 value.

Sub RenameSheet()<code style="box-sizing: inherit; font-size: 1em; font-family: Consolas, "Courier New", Courier, monospace;">
Dim rs As Worksheet

For Each rs In Sheets
rs.Name = rs.Range("C2")
Next rs

</code>End Sub

Thanks in advance!
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Just concatenate them...

Code:
Sub RenameSheet()
    Dim rs As Worksheet

    For Each rs In Sheets
        rs.Name = rs.Range("C2") & " " & rs.Range("A3")
    Next rs

End Sub
 
Upvote 0
Just concatenate them...

Code:
Sub RenameSheet()
    Dim rs As Worksheet

    For Each rs In Sheets
        rs.Name = rs.Range("C2") & " " & rs.Range("A3")
    Next rs

End Sub

Perfect! Thats what i was trying to do! just had a blank moment on how to concatenate them.

Thanks again.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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