ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro which inserts new sheet name (https://www.excelbanter.com/excel-programming/412683-macro-inserts-new-sheet-name.html)

Bevy

Macro which inserts new sheet name
 
Hi, I have a macro where I need to paste the content of a copied cell
as the sheets name. Below is example of where I am, but can't find
the syntax to paste the copied value when re-naming the sheet. Any
suggestions would be really appreciated.... thanks Bev


Sub selectandcopy()

Cells.Select
Selection.Copy
Sheets.Add
ActiveSheet.Paste
Range("E2").Select
Application.CutCopyMode = False
Selection.Copy
ActiveSheet.Select
ActiveSheet.Name = *****Paste copied selection from E2 here"
Sheets("Sheet2").Select
End Sub



Mike Fogleman[_2_]

Macro which inserts new sheet name
 
ActiveSheet.Copy Befo=Sheets(1)
'the new sheet is now the activesheet
ActiveSheet.Name = Range("E2").Value
Sheets("Sheet2").Activate

Mike F
"Bevy" wrote in message
...
Hi, I have a macro where I need to paste the content of a copied cell
as the sheets name. Below is example of where I am, but can't find
the syntax to paste the copied value when re-naming the sheet. Any
suggestions would be really appreciated.... thanks Bev


Sub selectandcopy()

Cells.Select
Selection.Copy
Sheets.Add
ActiveSheet.Paste
Range("E2").Select
Application.CutCopyMode = False
Selection.Copy
ActiveSheet.Select
ActiveSheet.Name = *****Paste copied selection from E2 here"
Sheets("Sheet2").Select
End Sub





Bevy

Macro which inserts new sheet name
 
On 16 Jun, 22:24, "Mike Fogleman" wrote:
ActiveSheet.Copy Befo=Sheets(1)
* * 'the new sheet is now the activesheet
ActiveSheet.Name = Range("E2").Value
Sheets("Sheet2").Activate

Mike F"Bevy" wrote in message

...



Hi, I have a macro where I need to paste the content of a copied cell
as the sheets name. *Below is example of where I am, but can't find
the syntax to paste the copied value when re-naming the sheet. * Any
suggestions would be really appreciated.... thanks Bev


Sub selectandcopy()


* *Cells.Select
* *Selection.Copy
* *Sheets.Add
* *ActiveSheet.Paste
* *Range("E2").Select
* *Application.CutCopyMode = False
* *Selection.Copy
* *ActiveSheet.Select
* *ActiveSheet.Name = *****Paste copied selection from E2 here"
* *Sheets("Sheet2").Select
End Sub- Hide quoted text -


- Show quoted text -


MIke - that fantastic thank you - so straight forward really but
couldn't get there. Thanks! Bev


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

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