|
在调试时一到With Workbooks("最后一步").Sheets(1)
下一句就下标越界,是为什么呢?
Public Sub HideDone()
Dim s1 As String, i As Long, j As Long, k As Long, l As Integer
h1 = WindowFromPoint(95, 56)
j = Range(ActiveCell, Cells(65535, ActiveCell.Column)).End(xlDown).Row
k = ActiveCell.Row
If ld1 = 0 Then ld1 = k
If ld1 <= j Then
With Workbooks("最后一步").Sheets(1)
s1 = .Cells(ld1, ActiveCell.Column).Value
SendMessage h1, WM_SETTEXT, 0, ByVal s1
.Cells(ld1, ActiveCell.Column + 1).Value = ld1 + 1 - k
End With
wsh.SendKeys "{f3}"
Sleep 400
wsh.SendKeys "%{s}"
Sleep 400
SendMessage h2, CB_SHOWDROPDOWN, True, 0&
SendMessage h2, CB_SETCURSEL, 1&, 0&
'Sleep 300
'wsh.SendKeys "{f5}"
'Sleep 300
'wsh.SendKeys " "
End If
ld1 = ld1 + 1
End Sub
- With Workbooks("最后一步.xls").Sheets(1)
复制代码或者你写全。
|
|