Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default 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
_ _
^ąŻ^
--


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
insert row / insert column command buttons fairgreen Excel Worksheet Functions 1 October 29th 07 02:41 PM
How can I insert a date with an icon (calendar) insert Alfredo Mederico[_2_] Excel Discussion (Misc queries) 4 September 21st 07 01:20 AM
unable to insert columns in excel, insert- columns (disabled) iam_leearner Excel Discussion (Misc queries) 1 August 13th 06 02:26 PM
Can I auto insert a worksheet when I insert a value in a cell. iainc Excel Worksheet Functions 0 April 27th 06 08:37 AM
Insert Next? Or insert a variable number of records...how? Tom MacKay Excel Discussion (Misc queries) 0 April 20th 06 10:44 PM


All times are GMT +1. The time now is 12:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"