Results 1 to 3 of 3

Thread: Month wise calender macro

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Junior Member
    Join Date
    Aug 2013
    Posts
    6
    Rep Power
    0
    Hi,

    ALT+F11 to open VB editor. Double click 'ThisWorkbook' and paste the code below in on the right. Close VB editor.
    Click a worksheet month in Q4 to Q15.
    Note you must now save your workbook as a macro enabled workbook with a .XLSM extension.


    Code:
    Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
    If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub
    Dim x As Long
    If Not Intersect(Target, Sh.Range("Q4:Q15")) Is Nothing Then
        Application.EnableEvents = False
        Application.ScreenUpdating = False
        For x = 1 To Worksheets.Count
        Sheets(x).Visible = True
        Next
        For x = 1 To Worksheets.Count
        If UCase(Left(Sheets(x).Name, 3)) <> UCase(Left(Target.Value, 3)) Then
            Sheets(x).Visible = False
        End If
        Next
        Range(Target.Address).Select
        Application.EnableEvents = True
         Application.ScreenUpdating = True
    End If
    End Sub
    Last edited by Mike H; 11-11-2013 at 04:37 PM.

Similar Threads

  1. MACRO CODE TO KNOW MONTH and QUATER
    By Prabhu in forum Excel Help
    Replies: 4
    Last Post: 09-27-2013, 10:16 PM
  2. Macro to change month and year on all sheet
    By Howardc in forum Excel Help
    Replies: 2
    Last Post: 08-15-2013, 05:58 PM
  3. Absolute Calender Program!
    By Preeti Verma in forum Excel Help
    Replies: 1
    Last Post: 11-06-2012, 01:19 PM
  4. Request for Calender
    By sanjeevi888 in forum Excel Help
    Replies: 1
    Last Post: 08-12-2012, 10:55 AM
  5. Splittting Data Into Different Worksheets Column Wise In VBA
    By rajeshd@live.in in forum Excel Help
    Replies: 1
    Last Post: 01-21-2012, 04:45 PM

Posting Permissions

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