Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 234
Default Naming a sheet from formula result

I would like to name a sheet from the result of a formula that gets is
result from a cell in a worksheet, the following is my routine but first
writes the formula to cell A1 in the worksheet, is there a more appropriate
method?

Dim shname As String
Range("A1").Formula = _
"=""DD""&Left(Right(A2, 10), 2) & Right(B2, 6)"
shname = Range("A1").Value
Range("A1").ClearContents
Sheets(1).Name = shname

Thanks, Rob


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Naming a sheet from formula result

I don't think you need a formula as there are VBA Left and Right methods. So
how about


Sheets(1).Name = "DD" & Left(Right(A2, 10), 2) & Right(B2, 6)



--
HTH

Bob Phillips

"Rob" wrote in message
...
I would like to name a sheet from the result of a formula that gets is
result from a cell in a worksheet, the following is my routine but first
writes the formula to cell A1 in the worksheet, is there a more

appropriate
method?

Dim shname As String
Range("A1").Formula = _
"=""DD""&Left(Right(A2, 10), 2) & Right(B2, 6)"
shname = Range("A1").Value
Range("A1").ClearContents
Sheets(1).Name = shname

Thanks, Rob




  #3   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 234
Default Naming a sheet from formula result

Bob,

Thanks for this, I amended to include Range so as I had set Options Explicit

Sheets(1).Name = "DD" & Left(Right(Range("A2"), 10), 2) &
Right(Range("B2"), 6)

"Bob Phillips" wrote in message
...
I don't think you need a formula as there are VBA Left and Right methods.
So
how about


Sheets(1).Name = "DD" & Left(Right(A2, 10), 2) & Right(B2, 6)



--
HTH

Bob Phillips

"Rob" wrote in message
...
I would like to name a sheet from the result of a formula that gets is
result from a cell in a worksheet, the following is my routine but first
writes the formula to cell A1 in the worksheet, is there a more

appropriate
method?

Dim shname As String
Range("A1").Formula = _
"=""DD""&Left(Right(A2, 10), 2) & Right(B2, 6)"
shname = Range("A1").Value
Range("A1").ClearContents
Sheets(1).Name = shname

Thanks, Rob






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Naming a sheet from formula result

of course ... should have spotted that :-)

Bob

"Rob" wrote in message
...
Bob,

Thanks for this, I amended to include Range so as I had set Options

Explicit

Sheets(1).Name = "DD" & Left(Right(Range("A2"), 10), 2) &
Right(Range("B2"), 6)

"Bob Phillips" wrote in message
...
I don't think you need a formula as there are VBA Left and Right methods.
So
how about


Sheets(1).Name = "DD" & Left(Right(A2, 10), 2) & Right(B2, 6)



--
HTH

Bob Phillips

"Rob" wrote in message
...
I would like to name a sheet from the result of a formula that gets is
result from a cell in a worksheet, the following is my routine but

first
writes the formula to cell A1 in the worksheet, is there a more

appropriate
method?

Dim shname As String
Range("A1").Formula = _
"=""DD""&Left(Right(A2, 10), 2) & Right(B2, 6)"
shname = Range("A1").Value
Range("A1").ClearContents
Sheets(1).Name = shname

Thanks, Rob








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Show formula result in another sheet Gotroots Excel Worksheet Functions 1 December 15th 09 10:18 PM
Naming the Result Cells on a Scenario Summary dsttexas Excel Discussion (Misc queries) 0 January 31st 08 12:05 AM
Can I annotate a formula result in Sheet 1 in Sheet 2 by Cell Addr Rebecca Bauer Excel Worksheet Functions 2 August 27th 07 07:20 PM
Sheet naming Pat Excel Programming 7 December 15th 04 10:29 PM
Naming a new sheet. Rich Cooper Excel Programming 1 May 25th 04 09:56 PM


All times are GMT +1. The time now is 07:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"