excel2007插入日期选择器的教程
相关话题
Excel中经常需要使用到日期选择器为用户提供选日期的便捷,插入日期选择器具体该如何操作呢?下面是由小编分享的excel2007插入日期选择器的教程,以供大家阅读和学习。
excel2007插入日期选择器的教程:
插入日期选择器步骤1:在某一单元格中插入日历控件
插入日期选择器步骤2:选中要插入日历控件的单元格,设置单元格格式为日期型;
插入日期选择器步骤3:点击工具栏,“插入—对象—日历控件”,
插入日期选择器步骤4:用快捷方式Alt+F11,双击插入控件的工作表名称,粘贴下面的代码,用来实现单击A1时弹出日历控件,单击日历控件后,将选中的日期值填入A1并隐藏控件。
Private Sub Calendar1_Click()
ActiveCell = Calendar1
Calendar1.Visible = False
[a2].Select
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$A$1" Then Calendar1.Visible = True
End Sub

有关其他版本插入日期选择器的教程:
插入日期选择器步骤1:在开发工具栏选择插入-其他控件,打开其他控件选择框。

插入日期选择器步骤2:在选择框中选择calendar control8.0,确定。

插入日期选择器步骤3:在适当的位置绘制日历,并将高度和宽度适当调整。这时的日历控件还比较原始,不会点击日期后自动隐藏日历并在单元格内填入日期,这时就需要添加自己的代码。

插入日期选择器步骤4:在设计模式下双击日历。
点击设计模式,当图表颜色变深后就是设计模式,打开代码编辑器。
在光标处输入下方的代码:
ActiveCell = Calendar1.Value Me.Calendar1.Visible = FalseEnd Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 1 Or Target.Column = 2 Then
'此处的1和2为你要显示日历的列序号
Me.Calendar1.Left = Target.Left Me.Calendar1.Top = Target.To If Target.Value <> "" Then Me.Calendar1.Value = Target.Value Else Me.Calendar1.Value = Now( End I Me.Calendar1.Visible = TruElse Me.Calendar1.Visible = FalseEnd If

插入日期选择器步骤5:关闭代码编辑器,将EXCEL保存为启用宏的工作薄。

插入日期选择器步骤6:再次打开该工作薄,点击第一列或者第二列,就可以弹出日历选择器,选择日期后,在单元格内会插入日期,日历选择器消失。注意这是在非编辑模式下才可以实现的。

插入日期选择器步骤7:EXCEL除了这个日历控件外还有一个另一个比较简单的日历选择器Microsoft date and time picker control(SP6)。

插入日期选择器步骤8:插入该控件后,在非设计模式下即可点击弹出日期选择界面。如下:

看了excel2007插入日期选择器的教程还看了:
1.excel2007插入日期选择器的方法
2.excel2007插入选择日期框的教程
3.excel2010添加日期选择器的教程
4.Excel 2007中如何输入时间日期
5.怎么在excel2007中设置日期
6.Excel2007日期与时间
7.excel2007怎么使用日期格式
excel2007插入日期选择器的教程的评论条评论