0% found this document useful (0 votes)
67 views

ExcelCalendarVBACode 01

Uploaded by

Santo ghal
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views

ExcelCalendarVBACode 01

Uploaded by

Santo ghal
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

' Paste this procedure in the Worksheet object in the VBA Projects panel

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

' check if the activecell is found within the Start Date or Completion Date
columns of the Project Table
If Not Intersect(Target,
Me.ListObjects("ProjectTable").ListColumns(3).DataBodyRange.Resize(, 2)) Is Nothing
Then
' display the calendar
ActiveSheet.Shapes("Calendar").Visible = True

' position the calendar next to the activecell


ActiveSheet.Shapes("Calendar").Left = ActiveCell.Left + ActiveCell.Width
ActiveSheet.Shapes("Calendar").Top = ActiveCell.Top + ActiveCell.Height
Else
' hide the calendar if a cell is selected outside the Start or Completion
Date columns
ActiveSheet.Shapes("Calendar").Visible = False
End If
End Sub

You might also like