Stephen
stephen at bondsoftware.co.nz
Tue May 26 02:08:36 CDT 2009
I don't know the answer to that other than I think that's the way it works. Have a look at http://support.microsoft.com/kb/288402 particularly the last example 'Move Multiple Sheets in ActiveWorkbook to Another Workbook' Stephen -----Original Message----- From: dba-tech-bounces at databaseadvisors.com [mailto:dba-tech-bounces at databaseadvisors.com] On Behalf Of Max Wanadoo Sent: Tuesday, 26 May 2009 6:31 p.m. To: Stephen Subject: Re: [dba-Tech] Excel VBA problem I know, but should the 1 be an i? How can everything in the loop go before 1? Is it zero based perhaps? Max -----Original Message----- From: dba-tech-bounces at databaseadvisors.com [mailto:dba-tech-bounces at databaseadvisors.com] On Behalf Of Stephen Sent: 26 May 2009 01:07 To: Discussion of Hardware and Software issues Subject: Re: [dba-Tech] Excel VBA problem The first is an 'i' (in a loop); the second is a '1' -----Original Message----- From: dba-tech-bounces at databaseadvisors.com [mailto:dba-tech-bounces at databaseadvisors.com] On Behalf Of Max Wanadoo Sent: Tuesday, 26 May 2009 11:01 a.m. To: Stephen Subject: Re: [dba-Tech] Excel VBA problem Is that a "1" or an "i"? could be a typo? Max -----Original Message----- From: dba-tech-bounces at databaseadvisors.com [mailto:dba-tech-bounces at databaseadvisors.com] On Behalf Of Stephen Sent: 25 May 2009 21:03 To: Discussion of Hardware and Software issues Subject: Re: [dba-Tech] Excel VBA problem Gustav and Max Reporting back ... I have since done a debug.print on each component of the failing line, as follows Debug.Print Workbooks(WorkbookName).Sheets(i).Name ' OK Debug.Print Workbooks(newFN).Sheets(1).Name ' fails Workbooks(WorkbookName).Sheets(i).Copy _ Before:=Workbooks(newFN).Sheets(1) I have re-tested, changing Sheets to Worksheets, but same error, same place :-< I got the syntax from MSKB 288402 (yeah I know, it's Excel for Mac but danged if I can find PC equivalent on KB) ... and from other sites which say basically the same thing (eg http://social.msdn.microsoft.com/forums/en-US/isvvba/thread/ 0a237cb5-544b-4cf6-b66c-da84a413c2e3/ Max, that technique of copying before Sheet(1) is specifically mentioned in 288402 Stephen -----Original Message----- From: dba-tech-bounces at databaseadvisors.com [mailto:dba-tech-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, 26 May 2009 12:46 a.m. To: Stephen Subject: Re: [dba-Tech] Excel VBA problem Hi Stephen and Max I've learned that you should use WorkSheet for Sheet when dealing with WorkSheets. /gustav >>> max.wanadoo at gmail.com 25-05-2009 14:17 >>> Is this :- Sheets(i).Copy _ Before:=Workbooks(newFN).Sheets(1) Saying:- Copy from sheet (i) to new work sheet and position before .Sheets(1)? Can you do that? Is there anything before sheet(1) Or have I misunderstood Max _______________________________________________ dba-Tech mailing list dba-Tech at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-tech Website: http://www.databaseadvisors.com _______________________________________________ dba-Tech mailing list dba-Tech at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-tech Website: http://www.databaseadvisors.com _______________________________________________ dba-Tech mailing list dba-Tech at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-tech Website: http://www.databaseadvisors.com _______________________________________________ dba-Tech mailing list dba-Tech at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-tech Website: http://www.databaseadvisors.com _______________________________________________ dba-Tech mailing list dba-Tech at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-tech Website: http://www.databaseadvisors.com