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 27th, 2007, 01:39 PM
Authorized User
 
Join Date: Mar 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to jgrant
Default Is it possible

is it possible to copy a sheet within the same workbook using vb? I have been stuck on this for days.

 
Old March 27th, 2007, 03:36 PM
Registered User
 
Join Date: Mar 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This is something you can discover by turning on the macro recorder and carrying out the action manually. The recorder cretes code like the following:

    Sheets("Sheet1").Copy After:=Sheets(1)


 
Old March 28th, 2007, 03:27 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

If you are using VB and Not VBA

Have the Workbook object also

Workbooks(1).Sheets("Sheet1").Copy After:=Sheets(Workbooks(1).Sheets.Count)

Cheers
Shasur

http://www.vbadud.blogspot.com









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