Consulting

Results 1 to 7 of 7

Thread: Solved: naming sheet after cell value

  1. #1
    VBAX Contributor
    Joined
    Feb 2008
    Posts
    193
    Location

    Solved: naming sheet after cell value

    i'm using excell 2003 dutch
    is it possible to name the sheet (Blad1 to Blad31) from a range of cells

    example I have 30 names Jan, piet, Klaas etc from blad1 cell a1 to cell a30. Now the sheet blad2 must get the name Jan and sheet blad3 must be named Piet etc

    Is this possible?

    Ger

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Private Sub Worksheet_Change(ByVal Target As Range)
    Const WS_RANGE As String = "A1:A30" '<== change to suit

    On Error GoTo ws_exit
    Application.EnableEvents = False

    If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
    With Target
    Worksheets(.Row + 1).Name = .Value
    End With
    End If

    ws_exit:
    Application.EnableEvents = True
    End Sub
    [/vba]

    This is worksheet event code, which means that it needs to be
    placed in the appropriate worksheet code module, not a standard
    code module. To do this, right-click on the sheet tab, select
    the View Code option from the menu, and paste the code in.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Contributor
    Joined
    Feb 2008
    Posts
    193
    Location
    Thanks for the quick help. This works fine for me.

    Ger

  4. #4
    VBAX Master CreganTur's Avatar
    Joined
    Jan 2008
    Location
    Greensboro, NC
    Posts
    1,676
    Location
    Welcome to the forum- it's always great to see new members.

    If your issue is resolved, please mark the thread as solved by using the Thread Tools button at the top of this thread. Select Mark As Solved to mark it as solved.

    This will help keep the forum clean.

    Thanks
    -Randy Shea
    I'm a programmer, but I'm also pro-grammar!
    If your issue is resolved, please use Thread Tools to mark your thread as Solved!

    PODA (Professional Office Developers Association) | Certifiable | MOS: Access 2003


  5. #5
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by CreganTur
    Welcome to the forum- it's always great to see new members.
    New? He has 80 posts!
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  6. #6
    VBAX Master CreganTur's Avatar
    Joined
    Jan 2008
    Location
    Greensboro, NC
    Posts
    1,676
    Location
    Quote Originally Posted by xld
    New? He has 80 posts!
    Dangit... well, new to me at least

    For some reason I thought he only had three posts... don't know why. Maybe the stress is getting to me. I'm waiting to interview for a new position in my company. Yeah, that's it- the stress... I'll go with that excuse.
    -Randy Shea
    I'm a programmer, but I'm also pro-grammar!
    If your issue is resolved, please use Thread Tools to mark your thread as Solved!

    PODA (Professional Office Developers Association) | Certifiable | MOS: Access 2003


  7. #7
    VBAX Contributor
    Joined
    Feb 2008
    Posts
    193
    Location
    Sorry,

    forgotten to mark solved. just done.


    Ger

Posting Permissions

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