Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.scripting.vbscript
external usenet poster
 
Posts: 26
Default How to move worksheet from vbscript

Hi,

I want to move the last worksheet to be the first, but I don't the syntax
becuase the method usually requires a named argument (Befo=location):

' create an Excel object
set xlApp = CreateObject("Excel.Application")
set xlWb = xlApp.ActiveWorkbook

' move the last worksheet to be the first...
xlWb.Sheets(xlWb.Sheets.Count).Move Befo=xlWb.Sheets(1)

This causes an error. I know that I can't use the Excel named argument
syntax, but then how DO I specify the location to move the sheet?

Many thanks in advance,

Robert Stober


  #2   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.scripting.vbscript
external usenet poster
 
Posts: 3
Default How to move worksheet from vbscript


"Robert Stober" wrote in message
...
Hi,

I want to move the last worksheet to be the first, but I don't the syntax
becuase the method usually requires a named argument (Befo=location):

' create an Excel object
set xlApp = CreateObject("Excel.Application")
set xlWb = xlApp.ActiveWorkbook

' move the last worksheet to be the first...
xlWb.Sheets(xlWb.Sheets.Count).Move Befo=xlWb.Sheets(1)

This causes an error. I know that I can't use the Excel named argument
syntax, but then how DO I specify the location to move the sheet?

Many thanks in advance,

Robert Stober

For the before method just use:
xlWb.Sheets(xlWb.Sheets.Count).Move xlWb.Sheets(1)

for after I think you need:
xlWb.Sheets(xlWb.Sheets.Count).Move , xlWb.Sheets(1)

For future just open Excel, alt+F11 then F2, choose Excel in top dropdown
box and search on move, you can see the syntax and if you have help
installed press F1 when on the relevant entry.

Joe


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
Run VBScript from Excel Amy M Excel Discussion (Misc queries) 4 September 19th 08 09:07 PM
conditional formatting + VBscript John C Excel Discussion (Misc queries) 2 December 23rd 06 08:20 PM
Worksheets.add in VBScript overwrites existing worksheet donparkerjr Excel Worksheet Functions 3 November 9th 06 07:09 PM
Unable to Insert Worksheet/Move and copy worksheet Excel 2003 lukerush Excel Worksheet Functions 2 September 7th 06 05:05 PM
Entering a formula via VBscript Jacqui Hurst Excel Programming 2 July 24th 03 04:19 PM


All times are GMT +1. The time now is 06:51 PM.

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"