Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I want to Name the active worksheet, then add a new worksheet and name that
worksheet. How would I do that? Thanks Brenda |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I want to add the new worksheet after the current active worksheet. I would
obvioulsy know the name of the current active worksheet. Brenda "Brenda" wrote: I want to Name the active worksheet, then add a new worksheet and name that worksheet. How would I do that? Thanks Brenda |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Brenda,
Sub test() Dim ws As Worksheet, sName As String sName = "MySheet" Set ws = Worksheets.Add(after:=ActiveSheet) On Error Resume Next ws.Name = sName If Err.Number = 1004 Then MsgBox "Cannot rename: " & ws.Name & vbCr & _ sName & " is already in use" End If On Error GoTo 0 End Sub Here "MySheet" is hardcoded, but you may want some other way of giving the name, an InputBox perhaps. Regards, Peter T "Brenda" wrote in message ... I want to add the new worksheet after the current active worksheet. I would obvioulsy know the name of the current active worksheet. Brenda "Brenda" wrote: I want to Name the active worksheet, then add a new worksheet and name that worksheet. How would I do that? Thanks Brenda |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Making for adding and naming a new sheet | Excel Discussion (Misc queries) | |||
Adding and Naming Multiple Worksheets | Excel Worksheet Functions | |||
naming worksheets | Excel Worksheet Functions | |||
Worksheets Add & Naming | Excel Programming | |||
Quick question about dynamically adding and naming worksheets | Excel Programming |