ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sheet Name (https://www.excelbanter.com/excel-programming/360875-sheet-name.html)

BOONER

Sheet Name
 
I need a macro that will change the names of the sheets in a workbook equal
to a given cell in those sheets

Crowbar via OfficeKB.com

Sheet Name
 
BOONER wrote:
I need a macro that will change the names of the sheets in a workbook equal
to a given cell in those sheets



sub userform_initialize()

dim x as long
For x = 1 to activeworkbook.sheets.count
activesheet.name = sheets(x).range("A").value
next x

end sub



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200605/1

BOONER

Sheet Name
 
Thanks this puts me on the right track. However, for some reason it is
naming the first sheet with data pulled from the third.

"Crowbar via OfficeKB.com" wrote:

BOONER wrote:
I need a macro that will change the names of the sheets in a workbook equal
to a given cell in those sheets



sub userform_initialize()

dim x as long
For x = 1 to activeworkbook.sheets.count
activesheet.name = sheets(x).range("A").value
next x

end sub



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200605/1


BOONER

Sheet Name
 
Okay, this works..........Thanks a lot Crowbar

Dim x As Long
For x = 3 To ActiveWorkbook.Sheets.Count
Sheets(x).Activate
ActiveSheet.Name = Sheets(x).Range("I7").Value
Next x

"BOONER" wrote:

Thanks this puts me on the right track. However, for some reason it is
naming the first sheet with data pulled from the third.

"Crowbar via OfficeKB.com" wrote:

BOONER wrote:
I need a macro that will change the names of the sheets in a workbook equal
to a given cell in those sheets



sub userform_initialize()

dim x as long
For x = 1 to activeworkbook.sheets.count
activesheet.name = sheets(x).range("A").value
next x

end sub



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200605/1



All times are GMT +1. The time now is 07:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com