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

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
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,214,971
Messages
6,122,525
Members
449,088
Latest member
RandomExceller01

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