![]() |
Rename a Worksheet within a Macro
I would like to code a macro that creates a new worksheet at the back of a
workbook and then renames the new sheet with a name derived from the value derived within a cell. I initially created the macro by recording keboard commands. Unfortunately the macro transformed the cell contents into the hard codes value within double quotes. I want the macro to work with any value held within the cell. |
Rename a Worksheet within a Macro
Worksheets.Add After:=Worksheets(Worksheets.Count)
ACtivesheet.Name = Worksheets("Sheet1").Range("A1").Value -- HTH Bob Phillips (remove nothere from email address if mailing direct) "AJChrumka" wrote in message ... I would like to code a macro that creates a new worksheet at the back of a workbook and then renames the new sheet with a name derived from the value derived within a cell. I initially created the macro by recording keboard commands. Unfortunately the macro transformed the cell contents into the hard codes value within double quotes. I want the macro to work with any value held within the cell. |
Rename a Worksheet within a Macro
Dim rng as Range, sh as Worksheet
set rng = Activesheet.Range("A1").Value set sh = worksheets.add( After:=Worksheets(worksheets.count)) sh.Name = rng.Text -- Regards, Tom Ogilvy "AJChrumka" wrote in message ... I would like to code a macro that creates a new worksheet at the back of a workbook and then renames the new sheet with a name derived from the value derived within a cell. I initially created the macro by recording keboard commands. Unfortunately the macro transformed the cell contents into the hard codes value within double quotes. I want the macro to work with any value held within the cell. |
All times are GMT +1. The time now is 05:37 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com