+ Reply to Thread
Results 1 to 5 of 5

[SOLVED] VBA - Event Change △, Tab Name, Variable Name Tab

Hybrid View

  1. #1
    Registered User
    Join Date
    07-26-2012
    Location
    _
    MS-Off Ver
    Excel 2010
    Posts
    31

    Question [SOLVED] VBA - Event Change △, Tab Name, Variable Name Tab

    Here is my problem, I would like an Event Change on Sheet2 "Data" tab to change whenever cell A1 is selected to change the tab name on Sheet1 "Jan" currently. Please see attachment included. If someone has another potential suggestion/work-around I'd be willing and open to all opinions. Thanks for your help! Potential problem is that Sheet1's VBA name won't change, but it's Excel name could potentially change from Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec.

    I've tried the following formula, but it is not working. If I could have someone who has a better understanding of VBA to help me I would appreciate it.


    Private Sub Worksheet_Change(ByVal Target As Range)
    
    If Target.Address = Range("$A$1") Then
         With Sheet1
              .name = .Range("A1").Value
         End With
    End If
    
    End Sub
    Attached Files Attached Files
    Last edited by xsoldoutx; 08-06-2012 at 11:01 AM. Reason: Added code tags

  2. #2
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: VBA - Event Change △, Tab Name, Variable Name Tab

    @ xsoldoutx

    Welcome to the forum.

    Please notice that code tags have been added to your post(s). The forum rules require them so please keep that in mind and add them yourself whenever showing code in any of your future posts. To see instructions for applying them, click on the Forum Rules button at top of the page and read Rule #3.
    Thanks.

  3. #3
    Registered User
    Join Date
    07-26-2012
    Location
    _
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: VBA - Event Change △, Tab Name, Variable Name Tab

    Thank you Cutter, I apologize for the lack of Code tags (tried to highlight it in blue). I have located the # [Code] tags and will use them in future posts. Thanks again!

  4. #4
    Registered User
    Join Date
    07-26-2012
    Location
    _
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: VBA - Event Change △, Tab Name, Variable Name Tab

    Maybe this problem was more difficult than I had expected.

  5. #5
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: unsolved VBA - Event Change △, Tab Name, Variable Name Tab

    I reckon
    Private Sub Worksheet_Change(ByVal Target As Range)
        If Not Intersect(Target, Range("A1")) Is Nothing Then
            Sheet1.Name = Range("A1").Value
        End If
    End Sub
    if you meant to name Sheet1 after A1 on the data sheet, not A1 on Sheet1
    Josie

    if at first you don't succeed try doing it the way your wife told you to

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1