ExcelBanter

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

skid

Change Sheet Name
 
Hello

I am trying to Change The worksheet name in a macro (NOT THE TAB NAME) is
this possible

Thanks


Norman Jones

Change Sheet Name
 
Hi Skid,

Try something like:

'==========
Sub Test2()

Sheets("Sheet1").Name = "New Sheet"

End Sub
'<<==========

---
Regards,
Norman



"skid" wrote in message
...
Hello

I am trying to Change The worksheet name in a macro (NOT THE TAB NAME) is
this possible

Thanks




Norman Jones

Change Sheet Name
 
Hi Skid,

I have belatedly see: "NOT THE TAB NAME", so please ignore my suggestion.

However, what do you mean by changing the sheet's name?

---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Skid,

Try something like:

'==========
Sub Test2()

Sheets("Sheet1").Name = "New Sheet"

End Sub
'<<==========

---
Regards,
Norman



"skid" wrote in message
...
Hello

I am trying to Change The worksheet name in a macro (NOT THE TAB NAME) is
this possible

Thanks






skid

Change Sheet Name
 
This is changing the wrong name propery. In the Properties pane I need to
change the (Name) property. is this possible in VB.

thanks skid

"Norman Jones" wrote:

Hi Skid,

Try something like:

'==========
Sub Test2()

Sheets("Sheet1").Name = "New Sheet"

End Sub
'<<==========

---
Regards,
Norman



"skid" wrote in message
...
Hello

I am trying to Change The worksheet name in a macro (NOT THE TAB NAME) is
this possible

Thanks





Norman Jones

Change Sheet Name
 
Hi Skid,

A sheet's codename cannot be altered programmatically at run time; it can,
of course, be changed manually from the VBE properties window.

---
Regards,
Norman



"skid" wrote in message
...
This is changing the wrong name propery. In the Properties pane I need to
change the (Name) property. is this possible in VB.

thanks skid

"Norman Jones" wrote:

Hi Skid,

Try something like:

'==========
Sub Test2()

Sheets("Sheet1").Name = "New Sheet"

End Sub
'<<==========

---
Regards,
Norman



"skid" wrote in message
...
Hello

I am trying to Change The worksheet name in a macro (NOT THE TAB NAME)
is
this possible

Thanks







skid

Change Sheet Name
 
I just found it in another post. it's the code Name

Thanks for the help.

"Norman Jones" wrote:

Hi Skid,

I have belatedly see: "NOT THE TAB NAME", so please ignore my suggestion.

However, what do you mean by changing the sheet's name?

---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Skid,

Try something like:

'==========
Sub Test2()

Sheets("Sheet1").Name = "New Sheet"

End Sub
'<<==========

---
Regards,
Norman



"skid" wrote in message
...
Hello

I am trying to Change The worksheet name in a macro (NOT THE TAB NAME) is
this possible

Thanks







Dave Peterson

Change Sheet Name
 
Maybe...

ThisWorkbook.VBProject.VBComponents("Sheet1").Name = "NewCodeName"

if you don't know the original codename:

dim wks as worksheet
set wks = activesheet
ThisWorkbook.VBProject.VBComponents(wks.codename). Name = "NewCodeName"





Norman Jones wrote:

Hi Skid,

A sheet's codename cannot be altered programmatically at run time; it can,
of course, be changed manually from the VBE properties window.

---
Regards,
Norman

"skid" wrote in message
...
This is changing the wrong name propery. In the Properties pane I need to
change the (Name) property. is this possible in VB.

thanks skid

"Norman Jones" wrote:

Hi Skid,

Try something like:

'==========
Sub Test2()

Sheets("Sheet1").Name = "New Sheet"

End Sub
'<<==========

---
Regards,
Norman



"skid" wrote in message
...
Hello

I am trying to Change The worksheet name in a macro (NOT THE TAB NAME)
is
this possible

Thanks





--

Dave Peterson

Norman Jones

Change Sheet Name
 
Hi Dave,

I was overly prepared to accept the accuracy of Microsoft's help:

'-----------------------------
CodeName Property

Returns the code name for the object. Read-only String.

Note The value that you see in the cell to the right of (Name) in the
Properties window is the code name of the selected object. At design time,
you can change the code name of an object by changing this value. You cannot
programmatically change this property at run time.

....
'<<--------------------------------

Thank you for the correction and the information.

---
Regards,
Norman



"Dave Peterson" wrote in message
...
Maybe...

ThisWorkbook.VBProject.VBComponents("Sheet1").Name = "NewCodeName"

if you don't know the original codename:

dim wks as worksheet
set wks = activesheet
ThisWorkbook.VBProject.VBComponents(wks.codename). Name = "NewCodeName"




Norman Jones wrote:

Hi Skid,

A sheet's codename cannot be altered programmatically at run time; it
can,
of course, be changed manually from the VBE properties window.

---
Regards,
Norman




skid

Change Sheet Name
 
Thanks Dave This works GREAT!!
have a good Turkey day.

"Dave Peterson" wrote:

Maybe...

ThisWorkbook.VBProject.VBComponents("Sheet1").Name = "NewCodeName"

if you don't know the original codename:

dim wks as worksheet
set wks = activesheet
ThisWorkbook.VBProject.VBComponents(wks.codename). Name = "NewCodeName"





Norman Jones wrote:

Hi Skid,

A sheet's codename cannot be altered programmatically at run time; it can,
of course, be changed manually from the VBE properties window.

---
Regards,
Norman

"skid" wrote in message
...
This is changing the wrong name propery. In the Properties pane I need to
change the (Name) property. is this possible in VB.

thanks skid

"Norman Jones" wrote:

Hi Skid,

Try something like:

'==========
Sub Test2()

Sheets("Sheet1").Name = "New Sheet"

End Sub
'<<==========

---
Regards,
Norman



"skid" wrote in message
...
Hello

I am trying to Change The worksheet name in a macro (NOT THE TAB NAME)
is
this possible

Thanks





--

Dave Peterson


Dave Peterson

Change Sheet Name
 
Yeah, but you can't do:
wks.codename = "newcodename"

(Chip Pearson was my original source, IIRC.)



Norman Jones wrote:

Hi Dave,

I was overly prepared to accept the accuracy of Microsoft's help:

'-----------------------------
CodeName Property

Returns the code name for the object. Read-only String.

Note The value that you see in the cell to the right of (Name) in the
Properties window is the code name of the selected object. At design time,
you can change the code name of an object by changing this value. You cannot
programmatically change this property at run time.

...
'<<--------------------------------

Thank you for the correction and the information.

---
Regards,
Norman

"Dave Peterson" wrote in message
...
Maybe...

ThisWorkbook.VBProject.VBComponents("Sheet1").Name = "NewCodeName"

if you don't know the original codename:

dim wks as worksheet
set wks = activesheet
ThisWorkbook.VBProject.VBComponents(wks.codename). Name = "NewCodeName"




Norman Jones wrote:

Hi Skid,

A sheet's codename cannot be altered programmatically at run time; it
can,
of course, be changed manually from the VBE properties window.

---
Regards,
Norman


--

Dave Peterson


All times are GMT +1. The time now is 10:25 AM.

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