tugsy
New Member
- Joined
- Aug 29, 2005
- Messages
- 26
Hi,
I have added some code to rename sheets in a spread sheet when it is being opened.
It works great until I get a name which is longer the 31 characters and then I get an error. (due to the limitation on the sheet name to 31 Characters)
so what I need is for the name to be truncated down to 30 characters, not in the original cell but only when the sheet is being named. I am not a VB coder. This code I found in this forum and used it in my work sheet.
Sub Workbook_Open()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
With ws
.Activate
.Name = Range("C8")
End With
Next ws
End Sub
Can any one please help. Thanks.
I have added some code to rename sheets in a spread sheet when it is being opened.
It works great until I get a name which is longer the 31 characters and then I get an error. (due to the limitation on the sheet name to 31 Characters)
so what I need is for the name to be truncated down to 30 characters, not in the original cell but only when the sheet is being named. I am not a VB coder. This code I found in this forum and used it in my work sheet.
Sub Workbook_Open()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
With ws
.Activate
.Name = Range("C8")
End With
Next ws
End Sub
Can any one please help. Thanks.