Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro
I would like to record a macro that allows me to insert a new sheet. However,
it inserts a DIFFERENT sheet no everytime. How should I write a sub that will technically allow me to insert a new sheet rather than a predefined sheet name like sheet 4 or sheet 5? thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro
Dim NewOne As Worksheet
Set NewOne = Worksheets.Add() NewOne.Name = "NewSheetName" If you need to specify where the sheet goes, you can use the Before or After parameters; see Help on the Worksheets Add Method for full details. "Natalie" wrote: I would like to record a macro that allows me to insert a new sheet. However, it inserts a DIFFERENT sheet no everytime. How should I write a sub that will technically allow me to insert a new sheet rather than a predefined sheet name like sheet 4 or sheet 5? thanks |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro
activesheet.name="whateveryoulike"
-- Don Guillett SalesAid Software "Natalie" wrote in message ... I would like to record a macro that allows me to insert a new sheet. However, it inserts a DIFFERENT sheet no everytime. How should I write a sub that will technically allow me to insert a new sheet rather than a predefined sheet name like sheet 4 or sheet 5? thanks |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro
Another method:
Sheets.Add.Name = "TEST" HTH "Natalie" wrote: I would like to record a macro that allows me to insert a new sheet. However, it inserts a DIFFERENT sheet no everytime. How should I write a sub that will technically allow me to insert a new sheet rather than a predefined sheet name like sheet 4 or sheet 5? thanks |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro
On Error Resume Next Set oWS = Worksheets("mySheet") On Error GoTo 0 If oWS Is Nothing Then Worksheets.Add.Name = "myTest" End If -- HTH Bob Phillips "Natalie" wrote in message ... I would like to record a macro that allows me to insert a new sheet. However, it inserts a DIFFERENT sheet no everytime. How should I write a sub that will technically allow me to insert a new sheet rather than a predefined sheet name like sheet 4 or sheet 5? thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro recorded... tabs & file names changed, macro hangs | Excel Worksheet Functions | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
how to count/sum by function/macro to get the number of record to do copy/paste in macro | Excel Programming | |||
macro to delete entire rows when column A is blank ...a quick macro | Excel Programming | |||
Start Macro / Stop Macro / Restart Macro | Excel Programming |