![]() |
Add a New Worksheet
How do I add a new worksheet and give it a name by using
code, the name will be entered in cell A1 of sheet 1. I want a button that I can click that will automatically create the Worksheet at the end of the book with the name in cell A1 THanks |
Add a New Worksheet
worksheets.Add(After:=Worksheets(worksheets.count) ).Name = _
Worksheets("sheet1").Range("A1") -- Regards, Tom Ogilvy "Jaina Williams" wrote in message ... How do I add a new worksheet and give it a name by using code, the name will be entered in cell A1 of sheet 1. I want a button that I can click that will automatically create the Worksheet at the end of the book with the name in cell A1 THanks |
Add a New Worksheet
Hi
the code for the button Sheets.Add(, Sheets(Sheets.Count)).Name = "nameyouwant" sheets(1).range("A1")="nameyouwant" regards Jaina Williams a écrit : How do I add a new worksheet and give it a name by using code, the name will be entered in cell A1 of sheet 1. I want a button that I can click that will automatically create the Worksheet at the end of the book with the name in cell A1 THanks |
Add a New Worksheet
THat worked so I tried some modifications to test
something, this is what I did Sheets("sheet2").Copy(After:=Worksheets_ (Worksheets.Count)).Name = Worksheets("sheet1").Range("A1") It tells me Object is required -----Original Message----- worksheets.Add(After:=Worksheets(worksheets.count )).Name = _ Worksheets("sheet1").Range("A1") -- Regards, Tom Ogilvy "Jaina Williams" wrote in message ... How do I add a new worksheet and give it a name by using code, the name will be entered in cell A1 of sheet 1. I want a button that I can click that will automatically create the Worksheet at the end of the book with the name in cell A1 THanks . |
Add a New Worksheet
Adding a worksheet returns a reference to that sheet. Copying a worksheet
does not. Thus your problem. Use this: Sheets("sheet2").Copy After:=Worksheets _ (Worksheets.Count) ActiveSheet.Name = Worksheets("sheet1").Range("A1") -- Regards, Tom Ogilvy "Jaina Williams" wrote in message ... THat worked so I tried some modifications to test something, this is what I did Sheets("sheet2").Copy(After:=Worksheets_ (Worksheets.Count)).Name = Worksheets("sheet1").Range("A1") It tells me Object is required -----Original Message----- worksheets.Add(After:=Worksheets(worksheets.count )).Name = _ Worksheets("sheet1").Range("A1") -- Regards, Tom Ogilvy "Jaina Williams" wrote in message ... How do I add a new worksheet and give it a name by using code, the name will be entered in cell A1 of sheet 1. I want a button that I can click that will automatically create the Worksheet at the end of the book with the name in cell A1 THanks . |
All times are GMT +1. The time now is 07:04 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com