+ Reply to Thread
Results 1 to 3 of 3

Get Worksheet tabs to automatically named?

  1. #1
    Registered User
    Join Date
    06-08-2007
    Posts
    22

    Question Get Worksheet tabs to automatically named?

    For an invoicing spreadsheet, I want a macro assigned to a button that will print an invoice, update 2 sheets of data with what was invoiced and copy and rename these updated sheets with the invoice number.


    I think I have it all figured out EXCEPT how to get the naming of these sheets. I found some code online that goes like this:
    Please Login or Register  to view this content.

    (found here:http://www.mrexcel.com/td0123.html)

    I can't seem to get this code to work. In VB editor, I've pasted this in, but either get no results, "argument not optional" errors...basically not the result I want.

    How can I get this code to work? Also, anticipating this macro to be run several times, is there going to be a problem with previously generated worksheets getting renamed?

    Hope I made myself understood. And any good recomendations for a poor student looking to teach themselves more on VBA?

    Thank you!
    Last edited by VBA Noob; 09-20-2007 at 03:18 AM.

  2. #2
    Registered User
    Join Date
    03-17-2005
    Posts
    18
    Hi,

    Did you paste the code into the ThisWorkbook module that you can see underneath your project? If not, it won't work. The code itself takes whatever value is in cell A1 of the worksheet and renames the tab to that value. Is this what you are trying to do, or does the invoice number appear in a cell other than A1?

    Perhaps if you posted a sample of the code it may be a bit clearer.

    Cheers

    Derek

  3. #3
    Registered User
    Join Date
    06-08-2007
    Posts
    22

    After some modification, I got it to do what I wanted

    There are three sheets, each with their name to be in different relative cells. This is the code I used:

    Please Login or Register  to view this content.
    Looking at this now, I suppose I could remove the Sheets("xXxXxXx").Select and just have them automatically renamed; might make for a faster/more visually pleasing operation.
    Last edited by stir-crazy; 09-20-2007 at 03:29 PM.

+ 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