PDA

View Full Version : Solved: naming sheet after cell value



Ger
03-16-2009, 06:26 AM
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

Bob Phillips
03-16-2009, 07:01 AM
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


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.

Ger
03-16-2009, 07:18 AM
Thanks for the quick help. This works fine for me.

Ger :bow:

CreganTur
03-16-2009, 08:58 AM
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:thumb

Bob Phillips
03-16-2009, 08:59 AM
Welcome to the forum- it's always great to see new members.

New? He has 80 posts! :rotlaugh:

CreganTur
03-16-2009, 09:07 AM
New? He has 80 posts! :rotlaugh:

Dangit... well, new to me at least:doh:

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.

Ger
03-19-2009, 12:57 AM
Sorry,

forgotten to mark solved. just done.


Ger