+ Reply to Thread
Results 1 to 2 of 2

Excel Tabs

  1. #1
    Registered User
    Join Date
    05-18-2005
    Posts
    17

    Excel Tabs

    Hi,

    I Hope Somebody Can Help Me,

    I Have A Workbook, With Each Sheet Name With Date Of The Month, For Example One Has March 7 And Next One March 14 So Each Tab It's 7 Days Diffrerence, I Have To Change It Every Month The Date, It's There Any Way I Can Just Change The First Sheet Or [tab] Date And Other Ones Change Too With Adding 7 Days Each.

    Thank You

    So Much For Your Help

  2. #2
    Forum Contributor
    Join Date
    11-09-2004
    Posts
    451
    Ignore my previous post

    paste the below code by selecting first sheet tab and rightclick->view code.

    For this code to see in action, change the first sheet name and click on any cell in the firstsheet.

    The name of sheet should in the format "month day" eg: "March 3"


    Dim nam As Variant

    Private Sub Worksheet_Activate()
    nam = ActiveSheet.Name
    End Sub

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim i As Integer
    i = 7
    If ActiveSheet.Name <> nam Then
    For Each w In Worksheets
    If w.Name <> ActiveSheet.Name Then
    iYear = Format(ActiveSheet.Name, "YYYY")
    iMonth = Format(ActiveSheet.Name, "MM")
    iday = Format(ActiveSheet.Name, "d")
    iDayOfWeek = Format(ActiveSheet.Name, "D")
    dtdate = iYear & "/" & iMonth & "/" & iday
    iNumberMoreDays = i
    dtdate = DateAdd("d", iNumberMoreDays, dtdate)
    w.Name = Format(dtdate, "mmm d")
    i = i + 7
    End If

    Next
    End If
    End Sub

+ 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