Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel Worksheets.Copy in VBS???

Hello,
I've been racking my brain and searching for
references to figure out how to copy and excel work sheet
with in a single work book to use as a template with in
that same work book. The only thing I can find is VBA
code, I'm doing an administration script in VBS and can't
figure out how to convert it.

According to Microsoft's reference the VBA command is:
Worksheets("Sheet1").Copy after := Worksheets("Sheet3")

I've got the VBS code below.

Set objExcel = WScript.CreateObject("EXCEL.application")
objExcel.Visible = True
objExcel.Workbooks.Add
objExcel.Worksheets.Add.Name ="USERSLIST"

This part of it objExcel.Worksheets("Sheet1").Copy will
copy the worksheet but to a new workbook. 8/

Any help at all on this would be greatly appreciated.

Thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Excel Worksheets.Copy in VBS???

Mark

This is not what you asked for but it might be suitable.

Sub CopyTable()
Set Table = Worksheets(2).Range("A3:D7")
Table.Copy Destination:=Worksheets(3).Range("a3")
With Worksheets(3)
Cells(1, 1).Select
Selection.ColumnWidth = 6
Range("B1:D1").Select
Selection.ColumnWidth = 5
Range("A1").Select
End With
End Sub

Copying preserves the data and format. The Column widths
and row heights need to be done separately.

Regards
Peter
-----Original Message-----
Hello,
I've been racking my brain and searching for
references to figure out how to copy and excel work sheet
with in a single work book to use as a template with in
that same work book. The only thing I can find is VBA
code, I'm doing an administration script in VBS and can't
figure out how to convert it.

According to Microsoft's reference the VBA command is:
Worksheets("Sheet1").Copy after := Worksheets("Sheet3")

I've got the VBS code below.

Set objExcel = WScript.CreateObject("EXCEL.application")
objExcel.Visible = True
objExcel.Workbooks.Add
objExcel.Worksheets.Add.Name ="USERSLIST"

This part of it objExcel.Worksheets("Sheet1").Copy will
copy the worksheet but to a new workbook. 8/

Any help at all on this would be greatly appreciated.

Thanks in advance
.

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
How to copy print set up to other excel worksheets? mcwhirter Setting up and Configuration of Excel 1 July 7th 06 12:30 AM
How do I copy text using a formula between worksheets in Excel? Guero Excel Worksheet Functions 2 March 23rd 06 06:31 PM
How do I automatically copy columns to/from Excel worksheets? Paul Excel Discussion (Misc queries) 2 December 28th 05 08:41 PM
Copy Excel worksheets TedDSC Excel Discussion (Misc queries) 2 December 27th 04 09:59 PM
In Excel, can I copy Headers and Footers between Worksheets? Brian Excel Worksheet Functions 1 November 12th 04 01:14 PM


All times are GMT +1. The time now is 08:57 PM.

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

About Us

"It's about Microsoft Excel"