运行时错误424 要求对象 20
其中:Calendar1.Visible=True显示黄色代码如下:(代码有删减,因为太长超字数了)PrivateSubWorksheet_SelectionChange...
其中:Calendar1.Visible = True 显示黄色
代码如下:(代码有删减,因为太长超字数了)
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'If Target.Column = 4 Or Target.Column = 15 Or Target.Column = 17 Or Target.Column = 19 Or Target.Column = 21 Or Target.Column = 23 Or Target.Column = 25 Or
'Target.Column = 27 Or Target.Column = 29 Or Target.Column = 32 Or Target.Column = 34 Or Target.Column = 36 Then
If Target.Row < 3 Then Exit Sub
If Target.Cells.Count > 1 Then Exit Sub
Dim ccMode As XlCutCopyMode
ccMode = Application.CutCopyMode
If ccMode = 0 Then
Set RngCutcopy = Nothing
Else
Set RngCutcopy = GetCutCopyRange
End If
Dim bInrange As Boolean
On Error Resume Next
bInrange = WorksheetFunction.Match(Target.Column, Array(4, 15, 17, 19, 21, 23, 25, 27, 29, 32, 34, 36), 0)
On Error GoTo 0
If bInrange Then
Calendar1.Visible = True
Calendar1.Top = Range("a1", ActiveCell).Height
Calendar1.Left = Range("a1", ActiveCell).Width + 10
Else
Calendar1.Visible = False
End If
If Not RngCutcopy Is Nothing Then
If ccMode = xlCopy Then
RngCutcopy.Copy
ElseIf ccMode = xlCut Then
RngCutcopy.Cut
End If
End If
End Sub
我本来用2007版本的可以运行,但一用到2010年版的就运行错误了 展开
代码如下:(代码有删减,因为太长超字数了)
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'If Target.Column = 4 Or Target.Column = 15 Or Target.Column = 17 Or Target.Column = 19 Or Target.Column = 21 Or Target.Column = 23 Or Target.Column = 25 Or
'Target.Column = 27 Or Target.Column = 29 Or Target.Column = 32 Or Target.Column = 34 Or Target.Column = 36 Then
If Target.Row < 3 Then Exit Sub
If Target.Cells.Count > 1 Then Exit Sub
Dim ccMode As XlCutCopyMode
ccMode = Application.CutCopyMode
If ccMode = 0 Then
Set RngCutcopy = Nothing
Else
Set RngCutcopy = GetCutCopyRange
End If
Dim bInrange As Boolean
On Error Resume Next
bInrange = WorksheetFunction.Match(Target.Column, Array(4, 15, 17, 19, 21, 23, 25, 27, 29, 32, 34, 36), 0)
On Error GoTo 0
If bInrange Then
Calendar1.Visible = True
Calendar1.Top = Range("a1", ActiveCell).Height
Calendar1.Left = Range("a1", ActiveCell).Width + 10
Else
Calendar1.Visible = False
End If
If Not RngCutcopy Is Nothing Then
If ccMode = xlCopy Then
RngCutcopy.Copy
ElseIf ccMode = xlCut Then
RngCutcopy.Cut
End If
End If
End Sub
我本来用2007版本的可以运行,但一用到2010年版的就运行错误了 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询