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 |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 10:35 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com