Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Export[] to XLS

  • To: mathgroup at smc.vnet.net
  • Subject: [mg62355] Re: [mg62337] Export[] to XLS
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Tue, 22 Nov 2005 04:41:57 -0500 (EST)
  • Reply-to: hanlonr at cox.net
  • Sender: owner-wri-mathgroup at wolfram.com

One way would be to import the intended sheet name into the first cell of 
each sheet and add the following macro to the code module of the workbook 
or an add-on.  Manually run the macro or put a call to it in an Auto_Open 
macro.


Bob Hanlon


        Public Sub reName_Sheets()
            '
            ' Renames sheets from their default names (e.g., "Sheet1")
            ' to value in sheet's first cell (A1) except when that cell is
            ' blank
            '
            Dim fenSheet ' Index used in For Each ... Next loop
            
            For Each fenSheet In Sheets
                
                If Left(fenSheet.Name, 5) = "Sheet" And _
                    Not fenSheet.Range("A1") = "" Then
                    
                    fenSheet.Name = fenSheet.Range("A1")
                    
                End If
                
            Next fenSheet ' in Sheets
            
        End Sub ' reName_Sheets


> 
> From: ggroup at sarj.ca
To: mathgroup at smc.vnet.net
> Date: 2005/11/21 Mon AM 03:54:19 EST
> Subject: [mg62355] [mg62337] Export[] to XLS
> 
> I occasionally need to export data sets (LxNxM) to Excel.  This
> usually works extremely well using Export["filename",data,"XLS"].  By
> default, Mathematica will create L worksheets, each with an NxM table.
> 
> My question is, is there a way to give a meaningful name to those
> worksheets from Mathematica?  Obviously the filename is specified, and
> it is fairly trivial to add column and/or row headings to the tables
> on each worksheet.  I just haven't found the trick to naming each
> worksheet automatically.
> 
> Thanks.
> 
> 


  • Prev by Date: Re: TagSetDelayed and UpValues
  • Next by Date: Re: Confusing results with N[expr]?
  • Previous by thread: Re: Export[] to XLS
  • Next by thread: TagSetDelayed and UpValues