View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mike S[_5_] Mike S[_5_] is offline
external usenet poster
 
Posts: 86
Default SOLVED: Copy sheet name to same cell on each sheet, 50 sheets;run code on any worhseet beforedoubleclick

On 4/3/2016 5:45 PM, GS wrote:
Perhaps simply...

Sub Insert_Sheetname()
Dim n&
On Error GoTo errorhandler
For n = 1 To ActiveWorkbook.Sheets.Count
With Sheets(n).Range("A5")
.Value = Sheets(n).Name: .Font.Bold = True: .Font.Size = 12
End With
Next

NormalExit:
Exit Sub

errorhandler:
MsgBox Err.Number & " " & Err.Description
End Sub

Yes much cleaner, thanks.