Thread: Renaming sheets
View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Nigel Nigel is offline
external usenet poster
 
Posts: 98
Default Renaming sheets

I tried your suggestion like this-
Worksheets("Sheet1").Name = Worksheets("Sheet1").Range("L1").Value
but it returned run time error 1004, Application-define oro Object defined
error.
When i said should there be a DOT in front of Range i meant in John's
suggestion.
Here is the code with the previous execution
Worksheets("Sheet1").Activate
With Worksheets("Sheet1")
.Columns("A:A").ColumnWidth = 16.14
.Columns("B:B").ColumnWidth = 4.29
.Columns("C:C").ColumnWidth = 4.29
.Columns("F:F").ColumnWidth = 4.29
.Columns("I:I").ColumnWidth = 4.29
.Columns("J:J").ColumnWidth = 4.29
.Columns("M:M").ColumnWidth = 4.29
.Columns("P:P").ColumnWidth = 4.29
.Columns("D:D").ColumnWidth = 7.57
.Columns("G:G").ColumnWidth = 7.57
.Columns("K:K").ColumnWidth = 7.57
.Columns("N:N").ColumnWidth = 7.57
.Columns("Q:Q").ColumnWidth = 7.57
.Columns("E:E").ColumnWidth = 7.86
.Columns("H:H").ColumnWidth = 7.86
.Columns("L:L").ColumnWidth = 7.86
.Columns("O:O").ColumnWidth = 7.86
.Columns("R:R").ColumnWidth = 7.86
End With
Worksheets("Sheet1").Name = Worksheets("Sheet1").Range("L1").Value
Range("A1").Select
Kind regards Nigel

"Mike H" wrote:

Yes there should

"Nigel" wrote:

Hi JB Should there be a DOT in front of Range ?

"john" wrote:

another way:

With Worksheets("Sheet1")
.Name = .Range("L1").Value
End With
--
JB


"Nigel" wrote:

In
Private Sub CommandButton1_Click()

I have written this code segment to rename "Sheet1" = to the cell value in
"L1" on the same sheet. The Private Sub is located in a different sheet, but
in the same workbook.

Worksheets("Sheet1").Activate
With Worksheets("Sheet1")
.Sheet.Name = Range("L1")
End With

It fails at the third line with "error 438" object does'nt support this
property or method.
Any ideas anyone
Nigel