发现了二义性的名称(worksheet_Change): ----------------------------------------------------- Private Sub worksheet_Change(ByVal Target As Range) If Target.Address = "$D$38" Then CommandButton1.Visible = Target <> "" End If End Sub Sub AdjustDTPInSht2() With Sheet2.DTPicker1 .Font.Size = 12 .Format = dtpLongDate .Height = Sheet2.Cells(1, 7).Height .Width = Sheet2.Cells(1, 7).Width + 28 '.Visible = False End With End Sub Private Sub dtpicker1_CloseUp() Applicahtionenableebernts = False ActiveCell.Value = Me.DTPicker1.Value Me.DTPicker1.Visible = False Application.EnableEvents = True End Sub Private Sub worksheet_Change(ByVal Target As Range) If Target.Count = 1 Then If Target.Column = 7 And Target = "" Then Me.DTPicker1.Visible = False End If End If End Sub |