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

Hi,

How can I write this code to place in the workbook of the file, the macro
changes the sheet tab name as per the individual sheet cell A1 which is
changed from the first sheet Index of Stock, I am looking to do this so it
changes instantly when the name is changed and do not need to calculate each
sheet, I have over 100 sheets.

Here is the macro

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

Many thanks

Mark
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Workbook Macro

Works perfectly here.


"terilad" wrote in message
...
Reason for repost was because programming was not working a short time

ago.

Mark

"Don Guillett" wrote:

Pls do NOT repost. See ans in previous thread. GEEZZZZZZZZZZZ

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"terilad" wrote in message
...
Hi,

How can I write this code to place in the workbook of the file, the

macro
changes the sheet tab name as per the individual sheet cell A1 which

is
changed from the first sheet Index of Stock, I am looking to do this

so it
changes instantly when the name is changed and do not need to

calculate
each
sheet, I have over 100 sheets.

Here is the macro

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

Many thanks

Mark


.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Workbook Macro

Do you know what A1 recalculated to that caused the error?

There are lots of things/characters/names that can't be used as a sheet name.

Slashes for dates is a common problem.

terilad wrote:

Reason for repost was because programming was not working a short time ago.

Mark

"Don Guillett" wrote:

Pls do NOT repost. See ans in previous thread. GEEZZZZZZZZZZZ

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"terilad" wrote in message
...
Hi,

How can I write this code to place in the workbook of the file, the macro
changes the sheet tab name as per the individual sheet cell A1 which is
changed from the first sheet Index of Stock, I am looking to do this so it
changes instantly when the name is changed and do not need to calculate
each
sheet, I have over 100 sheets.

Here is the macro

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

Many thanks

Mark


.


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Workbook Macro

Do I read this right - you have a list of sheet names on the first sheet
(Index of Stock) which a formula in cell A1 of the target sheet references?

What is the trigger for the sheet name to change? What is the structure of
Index of Stock?


"Project Mangler" wrote in message
...
Works perfectly here.


"terilad" wrote in message
...
Reason for repost was because programming was not working a short time

ago.

Mark

"Don Guillett" wrote:

Pls do NOT repost. See ans in previous thread. GEEZZZZZZZZZZZ

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"terilad" wrote in message
...
Hi,

How can I write this code to place in the workbook of the file, the

macro
changes the sheet tab name as per the individual sheet cell A1 which

is
changed from the first sheet Index of Stock, I am looking to do this

so it
changes instantly when the name is changed and do not need to

calculate
each
sheet, I have over 100 sheets.

Here is the macro

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

Many thanks

Mark

.





  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Workbook Macro

Yes you are right, sheet 1 is index of stock that contains 2 columns A3:A53
and B3:B53 containing items that are in stock, when I change one of the items
in the columns is changes the name in cell A1 on the individual stock sheet,
what I need to do is for the code to change the sheet name tab also so when I
click on the item in index of stock it finds the sheet tab with that name and
opens that sheet.

Mark

"Project Mangler" wrote:

Do I read this right - you have a list of sheet names on the first sheet
(Index of Stock) which a formula in cell A1 of the target sheet references?

What is the trigger for the sheet name to change? What is the structure of
Index of Stock?


"Project Mangler" wrote in message
...
Works perfectly here.


"terilad" wrote in message
...
Reason for repost was because programming was not working a short time

ago.

Mark

"Don Guillett" wrote:

Pls do NOT repost. See ans in previous thread. GEEZZZZZZZZZZZ

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"terilad" wrote in message
...
Hi,

How can I write this code to place in the workbook of the file, the

macro
changes the sheet tab name as per the individual sheet cell A1 which

is
changed from the first sheet Index of Stock, I am looking to do this

so it
changes instantly when the name is changed and do not need to

calculate
each
sheet, I have over 100 sheets.

Here is the macro

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

Many thanks

Mark

.





.

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Workbook Macro

Hi Mark,

Not sure if this will do all that you want: It assumes sheetnames in Col A
on the first sheet in the workbook:
A double click on the worksheet name in col A should open the sheet.

Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target
As Range, Cancel As Boolean)
Dim TgtName As String
On Error Resume Next
TgtName = Target.Value
Sheets(TgtName).Select
On Error GoTo 0
End Sub

Private Sub Workbook_SheetChange _
(ByVal Sh As Object, ByVal Target As Range)
On Error GoTo Errhandler
Application.EnableEvents = False
If Sh.Name < Trim("Index of Stock") Then Exit Sub
If Target.Column < 1 Then
Application.EnableEvents = True
Exit Sub
End If
If Target.Row - 1 Sheets.Count Then
Application.EnableEvents = True
Exit Sub
End If
Sheets(Target.Row - 1).Name = Target
Sheets(Target.Row - 1).Range("A1") = Target
Application.EnableEvents = True
Errhandler:
Application.EnableEvents = True
End Sub


"terilad" wrote in message
...
Yes you are right, sheet 1 is index of stock that contains 2 columns

A3:A53
and B3:B53 containing items that are in stock, when I change one of the

items
in the columns is changes the name in cell A1 on the individual stock

sheet,
what I need to do is for the code to change the sheet name tab also so

when I
click on the item in index of stock it finds the sheet tab with that name

and
opens that sheet.

Mark

"Project Mangler" wrote:

Do I read this right - you have a list of sheet names on the first sheet
(Index of Stock) which a formula in cell A1 of the target sheet

references?

What is the trigger for the sheet name to change? What is the structure

of
Index of Stock?


"Project Mangler" wrote in message
...
Works perfectly here.


"terilad" wrote in message
...
Reason for repost was because programming was not working a short

time
ago.

Mark

"Don Guillett" wrote:

Pls do NOT repost. See ans in previous thread. GEEZZZZZZZZZZZ

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"terilad" wrote in message
...
Hi,

How can I write this code to place in the workbook of the file,

the
macro
changes the sheet tab name as per the individual sheet cell A1

which
is
changed from the first sheet Index of Stock, I am looking to do

this
so it
changes instantly when the name is changed and do not need to
calculate
each
sheet, I have over 100 sheets.

Here is the macro

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

Many thanks

Mark

.





.



  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,522
Default Workbook Macro

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Application.DisplayAlerts = False
Dim WantedSheet As String
WantedSheet = Trim(ActiveCell.Value)
If WantedSheet = "" Then Exit Sub
On Error Resume Next
If Sheets(WantedSheet) Is Nothing Then
GetWorkbook ' calls another macro to do that
Else
Application.GoTo Sheets(WantedSheet).Range("a1")
End If
Application.DisplayAlerts = True
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"terilad" wrote in message
...
Yes you are right, sheet 1 is index of stock that contains 2 columns
A3:A53
and B3:B53 containing items that are in stock, when I change one of the
items
in the columns is changes the name in cell A1 on the individual stock
sheet,
what I need to do is for the code to change the sheet name tab also so
when I
click on the item in index of stock it finds the sheet tab with that name
and
opens that sheet.

Mark

"Project Mangler" wrote:

Do I read this right - you have a list of sheet names on the first sheet
(Index of Stock) which a formula in cell A1 of the target sheet
references?

What is the trigger for the sheet name to change? What is the structure
of
Index of Stock?


"Project Mangler" wrote in message
...
Works perfectly here.


"terilad" wrote in message
...
Reason for repost was because programming was not working a short
time
ago.

Mark

"Don Guillett" wrote:

Pls do NOT repost. See ans in previous thread. GEEZZZZZZZZZZZ

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"terilad" wrote in message
...
Hi,

How can I write this code to place in the workbook of the file,
the
macro
changes the sheet tab name as per the individual sheet cell A1
which
is
changed from the first sheet Index of Stock, I am looking to do
this
so it
changes instantly when the name is changed and do not need to
calculate
each
sheet, I have over 100 sheets.

Here is the macro

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
saving macro from workbook to Personal Macro Workbook KrispyData Excel Discussion (Misc queries) 1 March 25th 10 05:52 PM
How do I call up a line of code that references a cell/range in theactive workbook workbook where I am running my macro from? Lav Excel Programming 2 November 11th 08 05:04 PM
Macro to copy an image (or picture) from one workbook to a new sheetin another workbook Ruchir Excel Worksheet Functions 1 July 25th 08 07:29 AM
Running a macro to protect a workbook on a already protected workbook UNprotects the workbook ?? WimR Excel Programming 9 July 25th 05 12:44 PM
Excel Gurus = want a macro in 1 workbook to get info from another workbook = Read please harry Excel Programming 5 December 20th 03 03:26 AM


All times are GMT +1. The time now is 06:10 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"