Wrox Programmer Forums
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 10th, 2009, 06:23 AM
Authorized User
 
Join Date: Feb 2009
Posts: 16
Thanks: 1
Thanked 0 Times in 0 Posts
Default New workSheet adding

Dear all

I wanted a VB / Macros to create a new worksheet in my workbook that’s been copy from the Sheet1 all and name = Sheet1 Range (A2), Does it workable?
Your advice and help I highly appreciate.

Hope all have a Good Day
 
Old March 10th, 2009, 06:37 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

You can try this VBA code:

Code:
Sub CopySheet()
Dim oWS1 As Worksheet
Dim oWSNew As Worksheet
Set oWS1 = ActiveWorkbook.Sheets(1)
oWS1.Copy ActiveWorkbook.Sheets(1)
Set oWSNew = ActiveWorkbook.Sheets(1)
oWSNew.name = oWS1.Range("A2")
End Sub
Cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
 
Old March 10th, 2009, 07:29 AM
Authorized User
 
Join Date: Feb 2009
Posts: 16
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Work perfectly ,


Thanks





Similar Threads
Thread Thread Starter Forum Replies Last Post
adding new worksheet using user form sime_tyres Excel VBA 1 February 21st, 2006 12:35 AM
Open up Worksheet alannoble26 Excel VBA 5 February 13th, 2006 02:24 PM
finding a worksheet ozPATT Excel VBA 4 November 16th, 2005 10:54 AM
Email Worksheet alannoble26 Excel VBA 2 November 7th, 2005 10:33 AM
how to name worksheet by Month yylee Excel VBA 2 April 10th, 2004 01:01 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.