
excel vba中高级筛选有代码吗?我用宏录制后编程老是出错,高手指点!
如题,程序如下,判断“”空格不成,老是运行6次,现在老是报错IfCells(tji,5).Value=""ThenGoTotjifend这一项。PrivateSubCom...
如题,程序如下,判断“”空格不成,老是运行6次,现在老是报错 If Cells(tji, 5).Value = "" Then GoTo tjifend这一项。
Private Sub CommandButton1_Click()
Dim tji, tjj
For tjj = 6 To 238
If Cells(tjj, 4).Value = "" Then GoTo tjforend
Next
For tji = 16 To 34
tjforend:
If Cells(tji, 5).Value = "" Then GoTo tjifend
Range(Cells(5, 1), Cells(tjj, 4)).AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range( _
Cells(4, tji), Cells(5, tji)), CopyToRange:=Range(Cells(6, tji), Cells(6, tji + 1)), Unique:=False
tji = tji + 1
Next
tjifend:
End Sub
那个我知道,但是那个If Cells(tji, 5).Value = "" Then GoTo tjifend
这一项不管用,老是运行6次。 展开
Private Sub CommandButton1_Click()
Dim tji, tjj
For tjj = 6 To 238
If Cells(tjj, 4).Value = "" Then GoTo tjforend
Next
For tji = 16 To 34
tjforend:
If Cells(tji, 5).Value = "" Then GoTo tjifend
Range(Cells(5, 1), Cells(tjj, 4)).AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range( _
Cells(4, tji), Cells(5, tji)), CopyToRange:=Range(Cells(6, tji), Cells(6, tji + 1)), Unique:=False
tji = tji + 1
Next
tjifend:
End Sub
那个我知道,但是那个If Cells(tji, 5).Value = "" Then GoTo tjifend
这一项不管用,老是运行6次。 展开
1个回答
展开全部
Private Sub CommandButton1_Click()
Dim tji, tjj
For tjj = 6 To 238
If Cells(tjj, 4).Value = "" Then
For tji = 16 To 34
If Cells(tji, 5).Value = "" Then GoTo tjifend
Range(Cells(5, 1), Cells(tjj, 4)).AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range(Cells(4, tji), Cells(5, tji)), CopyToRange:=Range(Cells(6, tji), Cells(6, tji + 1)), Unique:=False
tji = tji + 1
Next tji
End If
Next tjj
tjifend:
end sub
Dim tji, tjj
For tjj = 6 To 238
If Cells(tjj, 4).Value = "" Then
For tji = 16 To 34
If Cells(tji, 5).Value = "" Then GoTo tjifend
Range(Cells(5, 1), Cells(tjj, 4)).AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range(Cells(4, tji), Cells(5, tji)), CopyToRange:=Range(Cells(6, tji), Cells(6, tji + 1)), Unique:=False
tji = tji + 1
Next tji
End If
Next tjj
tjifend:
end sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询