VBA find 方法那句一直报错,哪里写得有问题呀?谢谢各位~
Subro_report()DimiAsIntegerDimarr_TM1Dimrow_month,row_TM1AsIntegerDimrngAsRangerow_mo...
Sub ro_report()
Dim i As Integer
Dim arr_TM1
Dim row_month, row_TM1 As Integer
Dim rng As Range
row_month = Me.Range("A65536").End(xlUp).Row
row_TM1 = Sheet1.Range("A65536").End(xlUp).Row
arr_TM1 = Sheet1.Range("A26:A" & row_TM1)
For i = 26 To row_month
Set rng = arr_TM1.Find(what:=Me.Cells(i, 1).Value, LookIn:=xlValues)
If rng Is Nothing Then
Me.Rows(i).Delete
End If
Next
Set rng = Nothing
End Sub 展开
Dim i As Integer
Dim arr_TM1
Dim row_month, row_TM1 As Integer
Dim rng As Range
row_month = Me.Range("A65536").End(xlUp).Row
row_TM1 = Sheet1.Range("A65536").End(xlUp).Row
arr_TM1 = Sheet1.Range("A26:A" & row_TM1)
For i = 26 To row_month
Set rng = arr_TM1.Find(what:=Me.Cells(i, 1).Value, LookIn:=xlValues)
If rng Is Nothing Then
Me.Rows(i).Delete
End If
Next
Set rng = Nothing
End Sub 展开
1个回答
展开全部
arr_TIM1是个数组,数组没有find方法的。
你需要把arr_TIM1定义成Range对象。
Sub ro_report()
Dim i As Integer
Dim arr_TM1 As Range 'arr_TM1 定义为range对象变量
Dim row_month, row_TM1 As Integer
御握 Dim rng As Range
row_month = me.Range("A65536").End(xlUp).Row
row_TM1 = Sheet1.Range("A65536").End(xlUp).Row
Set arr_TM1 = Sheet1.Range("A26:A" & row_TM1) 'arr_TM1 对象 赋值为具体的查找区域
For i = 26 To row_month
Set rng = arr_TM1.Find(what:=Me.Cells(i, 1).Value, LookIn:=xlValues)
If rng Is Nothing Then
镇绝庆 Me.Rows(i).Delete
End If
Next
宏腊 Set rng = Nothing
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询