Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 10-20-2015, 12:11 AM
:) Sixthsense :)'s Avatar
:) Sixthsense :) :) Sixthsense :) is offline Auto rename tab Windows XP Auto rename tab Office 2010 32bit
Novice
 
Join Date: Oct 2015
Location: India
Posts: 1
:) Sixthsense :) is on a distinguished road
Default

Check whether this event code fulfills your expectation

To Add Excel VBA Code to a Workbook / This Workbook Module

  1. Copy the code that you want to use
  2. Select the workbook in which you want to store the code
  3. Hold the Alt key, and press the F11 key, to open the Visual Basic Editor
  4. In the Project Explorer, find your workbook, and open the list of Microsoft Excel Objects
  5. Right-click on the ThisWorkbook object, and choose View Code
  6. Where the cursor is flashing, choose Edit | Paste


Code:
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim sWs As String, sCell As String

sWs = UCase(Sh.Name)
sCell = UCase(Sh.Range("A2").Value)

If Trim(sCell) <> "" Then
    If Left(sWs, Len(sCell)) <> sCell Then
        On Error Resume Next
            Sh.Name = sCell & " " & sWs
        On Error GoTo 0
    End If
End If

End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Rename a Quick Part sleake Word 14 10-14-2013 09:21 AM
Variable to rename a tab in a worksheet via VBA Chayes Excel Programming 5 08-07-2012 02:03 AM
Rename Files gsrikanth Excel Programming 3 05-14-2012 03:03 AM
Can't rename shared calendars kenelder Outlook 0 06-02-2011 07:53 AM
Auto rename tab Rename File cksm4 Word VBA 2 02-25-2011 09:29 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:47 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft