Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 2 And Target.Row > 1 And Target.Row < 10000 Then
Set Sh = Sheets("sheet2")
Mrow = Target.Row
UserForm.Show
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With Me.DTPicker1
If Target.Count = 1 And Target.Column = 2 And (Not Target.Row < 7) Or Target.MergeCells Then
.Visible = True
.Top = Selection.Top
.Left = Selection.Left
.Height = Selection.Height
.Width = Selection.Width
If Target.Cells(1, 1) <> "" Then
.Value = Target.Cells(1, 1).Value
Else
.Value = Date
End If
Else
.Visible = False
End If
End With
End Sub
Private Sub DTPicker1_CloseUp()
ActiveCell.Value = Me.DTPicker1.Value
Me.DTPicker1.Visible = False
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count = 1 And Target.Column = 2 Or Target.MergeCells Then
If Target.Cells(1, 1).Value = "" Then
DTPicker1.Visible = False
End If
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range) '输入职工姓名
On Error Resume Next
If Target.Column = 2 And Target.Row > 6 And Target.Row < 10000 Then
Mrow = Target.Row
UserForm1.Show
Else
Unload UserForm1
End If
End Sub
Private Sub Calendar1_Click()
ActiveCell = Calendar1.Value
Me.Calendar1.Visible = False
End Sub
这行黄字与上面发生二意,又该怎么改?我是VAB白菜,搬别人的来用,我想目前是我最好的选择。VBA道道太多,不像函数好“移植”,麻烦再帮整整。多谢!
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With Me.DTPicker1
If Target.Count = 1 And Target.Column = 2 And (Not Target.Row < 7) Or Target.MergeCells Then
.Visible = True
.Top = Selection.Top
.Left = Selection.Left
.Height = Selection.Height
.Width = Selection.Width
If Target.Cells(1, 1) <> "" Then
.Value = Target.Cells(1, 1).Value
Else
.Value = Date
End If
Else
.Visible = False
End If
End With
End Sub
Private Sub DTPicker1_CloseUp()
ActiveCell.Value = Me.DTPicker1.Value
Me.DTPicker1.Visible = False
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count = 1 And Target.Column = 2 Or Target.MergeCells Then
If Target.Cells(1, 1).Value = "" Then
DTPicker1.Visible = False
End If
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range) '输入职工姓名
On Error Resume Next
If Target.Column = 2 And Target.Row > 6 And Target.Row < 10000 Then
Mrow = Target.Row
UserForm1.Show
Else
Unload UserForm1
End If
End Sub
Private Sub Calendar1_Click()
ActiveCell = Calendar1.Value
Me.Calendar1.Visible = False
End Sub
这行黄字与上面发生二意,又该怎么改?我是VAB白菜,搬别人的来用,我想目前是我最好的选择。VBA道道太多,不像函数好“移植”,麻烦再帮整整。多谢!