Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Re-Name a Worksheet..... with a Twist

I want to created a new worksheet via a macro button on say sheet1 - I can
do that thats not a problem

Then I want to re-name the new worksheet with a value that is typed in on a
certain cell in this new sheet2. Obviously I can't re-name until I create
the worksheet in the first place. How can I create an event to do this after
I have typed in to this cell.

I'm trying to set up a holiday timesheet, with a new sheet for each employee

Thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Re-Name a Worksheet..... with a Twist

Hi
Put the following code in your worksheet module:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("A1")) Is Nothing Then Exit Sub
On Error GoTo CleanUp
application.enableevents = false
With Target
If .Value < "" Then
Me.Name = .value
End If
End With
CleanUp:
Application.EnableEvents = True
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany

"John" schrieb im Newsbeitrag
...
I want to created a new worksheet via a macro button on say sheet1 -

I can
do that thats not a problem

Then I want to re-name the new worksheet with a value that is typed

in on a
certain cell in this new sheet2. Obviously I can't re-name until I

create
the worksheet in the first place. How can I create an event to do

this after
I have typed in to this cell.

I'm trying to set up a holiday timesheet, with a new sheet for each

employee

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Re-Name a Worksheet..... with a Twist

Thanks Frank

"Frank Kabel" wrote in message
...
Hi
Put the following code in your worksheet module:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("A1")) Is Nothing Then Exit Sub
On Error GoTo CleanUp
application.enableevents = false
With Target
If .Value < "" Then
Me.Name = .value
End If
End With
CleanUp:
Application.EnableEvents = True
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany

"John" schrieb im Newsbeitrag
...
I want to created a new worksheet via a macro button on say sheet1 -

I can
do that thats not a problem

Then I want to re-name the new worksheet with a value that is typed

in on a
certain cell in this new sheet2. Obviously I can't re-name until I

create
the worksheet in the first place. How can I create an event to do

this after
I have typed in to this cell.

I'm trying to set up a holiday timesheet, with a new sheet for each

employee

Thanks





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Re-Name a Worksheet..... with a Twist

Can't seem to get it to work. I have placed a value in A1 but nothing
happens. How can I initiate it?

"Frank Kabel" wrote in message
...
Hi
Put the following code in your worksheet module:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("A1")) Is Nothing Then Exit Sub
On Error GoTo CleanUp
application.enableevents = false
With Target
If .Value < "" Then
Me.Name = .value
End If
End With
CleanUp:
Application.EnableEvents = True
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany

"John" schrieb im Newsbeitrag
...
I want to created a new worksheet via a macro button on say sheet1 -

I can
do that thats not a problem

Then I want to re-name the new worksheet with a value that is typed

in on a
certain cell in this new sheet2. Obviously I can't re-name until I

create
the worksheet in the first place. How can I create an event to do

this after
I have typed in to this cell.

I'm trying to set up a holiday timesheet, with a new sheet for each

employee

Thanks





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Re-Name a Worksheet..... with a Twist

Hi
you have to put this code in your worksheet module 8not in a standard
module). Right-click on your tab name, choose 'code' and isert the code
in the appearing VBA editor

--
Regards
Frank Kabel
Frankfurt, Germany

"John" schrieb im Newsbeitrag
...
Can't seem to get it to work. I have placed a value in A1 but nothing
happens. How can I initiate it?

"Frank Kabel" wrote in message
...
Hi
Put the following code in your worksheet module:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("A1")) Is Nothing Then Exit Sub
On Error GoTo CleanUp
application.enableevents = false
With Target
If .Value < "" Then
Me.Name = .value
End If
End With
CleanUp:
Application.EnableEvents = True
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany

"John" schrieb im Newsbeitrag
...
I want to created a new worksheet via a macro button on say

sheet1 -
I can
do that thats not a problem

Then I want to re-name the new worksheet with a value that is

typed
in on a
certain cell in this new sheet2. Obviously I can't re-name until

I
create
the worksheet in the first place. How can I create an event to do

this after
I have typed in to this cell.

I'm trying to set up a holiday timesheet, with a new sheet for

each
employee

Thanks








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Re-Name a Worksheet..... with a Twist

Yeah it was in there Frank but I don't see any macro to run - should I


"Frank Kabel" wrote in message
...
Hi
you have to put this code in your worksheet module 8not in a standard
module). Right-click on your tab name, choose 'code' and isert the code
in the appearing VBA editor

--
Regards
Frank Kabel
Frankfurt, Germany

"John" schrieb im Newsbeitrag
...
Can't seem to get it to work. I have placed a value in A1 but nothing
happens. How can I initiate it?

"Frank Kabel" wrote in message
...
Hi
Put the following code in your worksheet module:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("A1")) Is Nothing Then Exit Sub
On Error GoTo CleanUp
application.enableevents = false
With Target
If .Value < "" Then
Me.Name = .value
End If
End With
CleanUp:
Application.EnableEvents = True
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany

"John" schrieb im Newsbeitrag
...
I want to created a new worksheet via a macro button on say

sheet1 -
I can
do that thats not a problem

Then I want to re-name the new worksheet with a value that is

typed
in on a
certain cell in this new sheet2. Obviously I can't re-name until

I
create
the worksheet in the first place. How can I create an event to do
this after
I have typed in to this cell.

I'm trying to set up a holiday timesheet, with a new sheet for

each
employee

Thanks








  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Re-Name a Worksheet..... with a Twist

Got it, but does that mean I have to manually insert this code in to every
new worksheet I create?


"John" wrote in message
...
Yeah it was in there Frank but I don't see any macro to run - should I


"Frank Kabel" wrote in message
...
Hi
you have to put this code in your worksheet module 8not in a standard
module). Right-click on your tab name, choose 'code' and isert the code
in the appearing VBA editor

--
Regards
Frank Kabel
Frankfurt, Germany

"John" schrieb im Newsbeitrag
...
Can't seem to get it to work. I have placed a value in A1 but nothing
happens. How can I initiate it?

"Frank Kabel" wrote in message
...
Hi
Put the following code in your worksheet module:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("A1")) Is Nothing Then Exit Sub
On Error GoTo CleanUp
application.enableevents = false
With Target
If .Value < "" Then
Me.Name = .value
End If
End With
CleanUp:
Application.EnableEvents = True
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany

"John" schrieb im Newsbeitrag
...
I want to created a new worksheet via a macro button on say

sheet1 -
I can
do that thats not a problem

Then I want to re-name the new worksheet with a value that is

typed
in on a
certain cell in this new sheet2. Obviously I can't re-name until

I
create
the worksheet in the first place. How can I create an event to do
this after
I have typed in to this cell.

I'm trying to set up a holiday timesheet, with a new sheet for

each
employee

Thanks










  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Re-Name a Worksheet..... with a Twist

Hi
this is an event procedure. There's nothing to run. It should happen
automatically. See
http://www.cpearson.com/excel/events.htm

--
Regards
Frank Kabel
Frankfurt, Germany

"John" schrieb im Newsbeitrag
...
Yeah it was in there Frank but I don't see any macro to run - should

I


"Frank Kabel" wrote in message
...
Hi
you have to put this code in your worksheet module 8not in a

standard
module). Right-click on your tab name, choose 'code' and isert the

code
in the appearing VBA editor

--
Regards
Frank Kabel
Frankfurt, Germany

"John" schrieb im Newsbeitrag
...
Can't seem to get it to work. I have placed a value in A1 but

nothing
happens. How can I initiate it?

"Frank Kabel" wrote in message
...
Hi
Put the following code in your worksheet module:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("A1")) Is Nothing Then Exit

Sub
On Error GoTo CleanUp
application.enableevents = false
With Target
If .Value < "" Then
Me.Name = .value
End If
End With
CleanUp:
Application.EnableEvents = True
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany

"John" schrieb im Newsbeitrag
...
I want to created a new worksheet via a macro button on say

sheet1 -
I can
do that thats not a problem

Then I want to re-name the new worksheet with a value that is

typed
in on a
certain cell in this new sheet2. Obviously I can't re-name

until
I
create
the worksheet in the first place. How can I create an event

to do
this after
I have typed in to this cell.

I'm trying to set up a holiday timesheet, with a new sheet

for
each
employee

Thanks









Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sum with a Twist Q Seanie Excel Worksheet Functions 0 December 30th 08 02:29 PM
Sum with a Twist Q Seanie Excel Worksheet Functions 2 December 30th 08 01:11 PM
If but with a twist:( AVB Over My Head New Users to Excel 3 September 16th 08 04:43 AM
Sum with a twist andrew Excel Discussion (Misc queries) 15 June 18th 08 08:56 AM
a twist on a VLOOKUP? Valerie Excel Discussion (Misc queries) 12 August 15th 07 01:14 PM


All times are GMT +1. The time now is 06:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"