![]() |
Insert Excel Sheeet using VBA
Does someone know how to insert a worksheet into a workbook using VBA.
I need to insert a sheet called "Duplicate" on the fly is does not already exist. Does anyone know how? tahnks & regards J |
Insert Excel Sheeet using VBA
Dim sh as Worksheet
On Error Resume Next set sh = Worksheets("Duplicate") On Error goto 0 if sh is nothing then set sh = worksheets.Add(After:=Worksheets(worksheets.count) ) End if Sh.Activate -- Regards, Tom Ogilvy "JP SIngh" wrote in message ... Does someone know how to insert a worksheet into a workbook using VBA. I need to insert a sheet called "Duplicate" on the fly is does not already exist. Does anyone know how? tahnks & regards J |
Insert Excel Sheeet using VBA
Hi,
Option Explicit Sub TEST() Dim SHT As Object On Error Resume Next Set SHT = Sheets("Duplicate") On Error GoTo 0 If SHT Is Nothing Then Set SHT = Worksheets.Add(After:=Worksheets(Worksheets.Count) ) SHT.Name = "Duplicate" End If SHT.Activate End Sub -- Regards, Soo Cheon Jheong _ _ ^вп^ -- |
All times are GMT +1. The time now is 05:06 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com