+ Reply to Thread
Results 1 to 7 of 7

Automatically Insert Titles to New Sheet

  1. #1
    Registered User
    Join Date
    07-14-2009
    Location
    bc, jersey
    MS-Off Ver
    Excel 2003
    Posts
    3

    Automatically Insert Titles to New Sheet

    Right now I have a program which exports data to excel. Every time this program exports a new dataset, it automatically creates a new sheet in excel. I want each new sheet that is automatically created to have the same titles in the first row (the data starts in the second row). So far I haven't had any luck. Any help would be appreciated. Thanks.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Automatically Insert Titles to New Sheet

    you could use a new sheet event in the workbook module
    simplest format is
    Please Login or Register  to view this content.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Registered User
    Join Date
    07-14-2009
    Location
    bc, jersey
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Automatically Insert Titles to New Sheet

    OK I tried entering that code and excel does indeed appear to be running it because the first time I tried it it made me change my security settings for macros. But still not luck - the new sheets being created do not have the titles I specified in the first row of cells. I'm stuck.

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Automatically Insert Titles to New Sheet

    whats your existing code?

  5. #5
    Registered User
    Join Date
    07-14-2009
    Location
    bc, jersey
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Automatically Insert Titles to New Sheet

    I used exactly what you gave me just to see if it would work. Disclaimer: I know almost nothing about macros or VB.

  6. #6
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Automatically Insert Titles to New Sheet

    how is sheet created by existing programme?

  7. #7
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Automatically Insert Titles to New Sheet

    I used exactly what you gave me just to see if it would work. Disclaimer: I know almost nothing about macros or VB.
    Possibly you did not put the code in the correct module.
    The code must be pasted into the module named "ThisWorkbook"

    Right-click the Excel icon next to "File" in the menu bar and select "View Code". The VBE will open up and that module will be the active module.

    In the code window, paste in the entire bit of code.
    Close the VBE.

    If it still doesn't work, then you'll need to answer the question about how the new worksheets are created.

    At the worst, you can run a macro manually to enter the values for the header. This code assumes the newly added worksheet is the activesheet.
    It must be placed into a "Standard Module".
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1