Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Private Sub Workbook

Hi,

I was wondering how I can place the following macro into the workbook rather
than having to inpu this code into over 100 individual sheets, the code
changes the sheet tab name to that of cell A1 per every sheet, these are
changed from the first sheet called Index of Stock, so when the name is
changed in the index of stock it changes instantly on the individual sheet
and the sheet tab. Here's the code.

Private Sub Worksheet_Calculate()
With Me.Range("A1")
If .Value < "" Then
Me.Name = .Value
End If
End With
End Sub


Many thanks

Mark
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,522
Default Private Sub Workbook

Place in the ThisWorkbook module. Either of the below should work

Private Sub Workbook_SheetChange _
(ByVal Sh As Object, ByVal Target As Range)

If Target.Address < Range("a1").Address Or _
Target = "" Then Exit Sub

Sh.Name = Target

'With Sh.Range("A1")
' If .Value < "" Then Sh.Name = .Value
'End With

End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"terilad" wrote in message
...
Hi,

I was wondering how I can place the following macro into the workbook
rather
than having to inpu this code into over 100 individual sheets, the code
changes the sheet tab name to that of cell A1 per every sheet, these are
changed from the first sheet called Index of Stock, so when the name is
changed in the index of stock it changes instantly on the individual sheet
and the sheet tab. Here's the code.

Private Sub Worksheet_Calculate()
With Me.Range("A1")
If .Value < "" Then
Me.Name = .Value
End If
End With
End Sub


Many thanks

Mark


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
Improve method of calling a private function in a private module XP Excel Programming 1 April 30th 08 06:41 PM
Private Sub Workbook_Open() event won't fire if workbook is hidden? Mike Weaver Excel Programming 2 February 15th 06 01:38 PM
Private Sub Workbook Open() - question Anthony Excel Programming 5 October 11th 05 06:39 PM
re : Possible to run private sub macros by writing another private ddiicc Excel Programming 5 August 26th 05 04:49 AM
Add code to Private Sub ComboBox1_Change() with a macro from a different workbook help_wanted[_2_] Excel Programming 4 April 2nd 04 06:47 PM


All times are GMT +1. The time now is 05:33 PM.

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

About Us

"It's about Microsoft Excel"