ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Naming worksheets (https://www.excelbanter.com/excel-programming/332894-naming-worksheets.html)

ozcank[_18_]

Naming worksheets
 

Hi All

Is there a way of giving the worksheet name the same as the value of a
cell?

Thanks

Oz


--
ozcank


------------------------------------------------------------------------
ozcank's Profile: http://www.excelforum.com/member.php...fo&userid=5328
View this thread: http://www.excelforum.com/showthread...hreadid=382406


Kaak[_14_]

Naming worksheets
 

You can do by sheetname:

Sheets("Sheet1").Name = Range("A1").value

or by sheetindex

Sheets(1).Name = Range("A1").value


--
Kaak
------------------------------------------------------------------------
Kaak's Profile: http://www.excelforum.com/member.php...fo&userid=7513
View this thread: http://www.excelforum.com/showthread...hreadid=382406


[email protected]

Naming worksheets
 
Hi,

Yeah just pass the name of the cell to a variable and then use that to
name the sheet, something like:

Dim ShtName as string
ShtName = Range("A5").value
Activesheet.name = ShtName

If you then wanted to name quite a few you could then just set a loop
hence the reason I used activesheet rather than sheets("name")

James


Liedson31

Naming worksheets
 
hi ozcank...

try this:

imagine sheets(1) as the first sheet of the workbook:
Sheets(1).Name = Cells(1, 1)

sheet(1) have the value of first row,column

Miguel

"ozcank" wrote:


Hi All

Is there a way of giving the worksheet name the same as the value of a
cell?

Thanks

Oz


--
ozcank


------------------------------------------------------------------------
ozcank's Profile: http://www.excelforum.com/member.php...fo&userid=5328
View this thread: http://www.excelforum.com/showthread...hreadid=382406



Toppers

Naming worksheets
 


Worksheets("Sheet1").name=Range("A1").Value

You can omit the ".Value"

"ozcank" wrote:


Hi All

Is there a way of giving the worksheet name the same as the value of a
cell?

Thanks

Oz


--
ozcank


------------------------------------------------------------------------
ozcank's Profile: http://www.excelforum.com/member.php...fo&userid=5328
View this thread: http://www.excelforum.com/showthread...hreadid=382406



ozcank[_19_]

Naming worksheets
 

Thanks guys, it works perfectly now.

Cheers

Oz


--
ozcank


------------------------------------------------------------------------
ozcank's Profile: http://www.excelforum.com/member.php...fo&userid=5328
View this thread: http://www.excelforum.com/showthread...hreadid=382406



All times are GMT +1. The time now is 06:29 PM.

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