Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Naming worksheets
Hi, I have a macro that makes a copy of sheet2 at the end of the workbook. Is it possible to change the name of the new workseet to the contents of a cell in sheet1? Thanks, Simon -- simonhall ------------------------------------------------------------------------ simonhall's Profile: http://www.excelforum.com/member.php...o&userid=30582 View this thread: http://www.excelforum.com/showthread...hreadid=502292 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Naming worksheets
Sure. You should check to make sure that the name in the Cell will not be a
duplicate of another sheet name. sheet2.copy After:=Sheet2 'The copied sheet is now the active sheet With activesheet if sheetexists(.range("A1").Text) = false then .name = .range("A1").Text end with Public Function SheetExists(SName As String, _ Optional ByVal Wb As Workbook) As Boolean 'Chip Pearson On Error Resume Next If Wb Is Nothing Then Set Wb = ThisWorkbook SheetExists = CBool(Len(Wb.Sheets(SName).Name)) End Function -- HTH... Jim Thomlinson "simonhall" wrote: Hi, I have a macro that makes a copy of sheet2 at the end of the workbook. Is it possible to change the name of the new workseet to the contents of a cell in sheet1? Thanks, Simon -- simonhall ------------------------------------------------------------------------ simonhall's Profile: http://www.excelforum.com/member.php...o&userid=30582 View this thread: http://www.excelforum.com/showthread...hreadid=502292 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
naming worksheets | Excel Programming | |||
Naming Worksheets | Excel Programming | |||
Naming worksheets... | Excel Discussion (Misc queries) | |||
naming worksheets | Excel Worksheet Functions | |||
Naming Worksheets in VBE | Excel Programming |