VBA code to remane shhets

Harikrushna

New Member
Joined
Oct 31, 2014
Messages
18
I have list of 162 names.

I also have 162 sheets in workbook.

I want to give name to 162 sheets from the list of 162 names.

please provide VB code.
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Code:
Option Explicit


Sub rename()
    Dim  i As Long
     Dim ws As Worksheet
    i = 2
    For Each ws In Worksheets
        If ws.Name <> "list" Then
            ws.Name = Sheets("list").Range("B" & i)
            i = i + 1
        End If
     Next ws
End Sub
 
Last edited:
Upvote 0
When you run the code, click on debug and tell us which line of code is highlighted. I just ran the code and it works for me. Cannot replicate your issue. Double check that you copied the code correctly.
 
Last edited:
Upvote 0
I have list of 162 names.

I also have 162 sheets in workbook.

I want to give name to 162 sheets from the list of 162 names.

please provide VB code.

Harikrushna,

1. Is this a homework assignment?

2. So that we can better understand what you are asking, can we see your workbook/worksheets?

You can post your workbook/worksheets to the following free site (sensitive data changed), mark the workbook for sharing, and, provide us with a link to your workbook:

https://dropbox.com
 
Upvote 0

Forum statistics

Threads
1,216,118
Messages
6,128,939
Members
449,480
Latest member
yesitisasport

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