+ Reply to Thread
Results 1 to 4 of 4

How to name the list

  1. #1
    Registered User
    Join Date
    02-10-2006
    Posts
    5

    How to name the list

    Firstly I made a type mistake: In my language version "Sheet" is "List"

    Hello guys
    I need help. I am trying to write my first VBA code. First complication has already occured :-).
    I want to name the sheet after cell, including cell´s format (00"/"0000"/"00)

    I use this simple code but doesn´t work properly:

    Private Sub CommandButton2_Click()
    ActiveSheet.Name = ActiveSheet.Range("B1").Value
    End Sub



    For instance: The cell has content : 05/4103/01 and I need to get this into Sheet´s name field.

    My procedure returns only 5410301 as a Sheet name


    Thank you for your advices
    Last edited by Toman; 02-21-2006 at 05:24 AM.

  2. #2
    Norman Jones
    Guest

    Re: How to name the list

    Hi Toman

    The slash (/) is not a legal sheet name character.

    Changing the slash for (say) a hyphen, your code worked for me.


    ---
    Regards,
    Norman


    "Toman" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hello guys
    > I need help. I am trying to write my first VBA code. First complication
    > has already occured :-).
    > I want to name the list after cell, including cellīs format
    > (00"/"0000"/"00)
    >
    > I use this simple code but doesnīt work properly:
    >
    > Private Sub CommandButton2_Click()
    > ActiveSheet.Name = ActiveSheet.Range("B1").Value
    > End Sub
    >
    >
    >
    > For instance: The cell has content : 05/4103/01 and I need to get this
    > into Listīs name field.
    >
    > My procedure returns only 5410301 as a List name
    >
    >
    > Thank you for your advices
    >
    >
    > --
    > Toman
    > ------------------------------------------------------------------------
    > Toman's Profile:
    > http://www.excelforum.com/member.php...o&userid=31397
    > View this thread: http://www.excelforum.com/showthread...hreadid=514795
    >




  3. #3
    Norman Jones
    Guest

    Re: How to name the list

    Hi Toman,

    > Changing the slash for (say) a hyphen, your code worked for me.


    Or, more explicitly:

    ActiveSheet.Name = _
    Format(ActiveSheet.Range("B1").Value, "00-0000-00")


    ---
    Regards,
    Norman



  4. #4
    Registered User
    Join Date
    02-10-2006
    Posts
    5
    Thank you Norman.
    Now it is working perfectly
    Last edited by Toman; 02-21-2006 at 06:41 AM.

+ 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