在指定范围的列,显示calendar插件
'[1]sheet1
Private Sub Calendar1_Click()
ActiveCell = Calendar1.Value
'Me.Calendar1.Visible = False
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rowword As String, colword As String
a = "" '←rowword
b = "" '←colword
row1 = Range("a1:a65535").Find(a, , , xlWhole).Row '定位行
col1 = Range("a" & row1 & ":aa" & row1).Find(b, , , xlWhole).Column '定位列
If Target.Column = col1 And row1 < Target.Row And Target.Row < _
Range("a1:a65535").Find(a & "-结束", , , xlWhole).Row Then
Me.Calendar1.Top = Target.Offset(1, 0).Top '设定控件的显示位置
Me.Calendar1.Left = Target.Offset(0, 1).Left
Me.Calendar1.Visible = True
Else
Me.Calendar1.Visible = False
End If
End Sub