VBA代码,出现下标越界问题。求差错
代码如下:Subkiller()Workbooks.Open("C:\general.txt")Application.Workbooks("general.txt")....
代码如下:
Sub killer()
Workbooks.Open ("C:\general.txt")
Application.Workbooks("general.txt").Worksheets("Sheet1").Activate ‘应该是这行有问题...
With ActiveSheet.Range("a1:a300")
Set c = .Find("lsps -a", LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Value = 5
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
End Sub
为什么我对general的sheet activate了,可是后面的操作还是在原来的book1里操作? 展开
Sub killer()
Workbooks.Open ("C:\general.txt")
Application.Workbooks("general.txt").Worksheets("Sheet1").Activate ‘应该是这行有问题...
With ActiveSheet.Range("a1:a300")
Set c = .Find("lsps -a", LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Value = 5
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
End Sub
为什么我对general的sheet activate了,可是后面的操作还是在原来的book1里操作? 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询