带有宏的excel工作簿在Windows XP / Office 2003早期工作得很好,我最近将电子表格移到了WIN7 / Office 2013。它与主要功能一起工作正常,但不保持光标位置。它假设将光标位置始终保持在B10,而不是它转到B11 ..以下是第1页中的代码
Private Sub Worksheet_Change(ByVal Target As Range)
Dim KeyCells As Range
Set KeyCells = Range("A1:C12")
Worksheets("Sheet1").ScrollArea = "B10:B11"
If Not Application.Intersect(KeyCells, Range(Target.Address)) _
Is Nothing Then
Range("B10").Select
End If
End Sub
Sub Auto_Open()
'
' Auto_Open Macro
'
' Clears cells B10 and B11 and focus cursor on cell B10
Range("B11").Select
Selection.ClearContents
Selection.ClearContents
End Sub
Sub Macro1()
'
' Macro1 Macro
'
Range("B10:c12").Select
End Sub
提前致谢