View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Assign Macro to cell???

Place this in the Thisworkbook module Ric

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Target.Address = "$A$1" Then
If Target.Value < "" Then
On Error Resume Next
ActiveSheet.Name = Target.Value
On Error GoTo 0
End If
End If
End Sub

If you change A1 in each sheet the tab name will change to the cell value



--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Ric" wrote in message ...
I want to run a macro in excel, such that when a name is typed into a cell
and Return pressed the name becomes the sheet name...

I have used: ActiveSheet.name = ActiveCell.value to do the naming

Ideally this would work with the down arrow or tab as well - or even better,
whenever the cell 'loses focus'.

I hope this is as blindingly simple as I feel it should be...

Thanks in advance

Ric