乔山办公网我们一直在努力
您的位置:乔山办公网 > excel表格制作 > <em>Excel</em> 用<em>VBA</em>怎么多条件查找并

<em>Excel</em> 用<em>VBA</em>怎么多条件查找并

作者:乔山办公网日期:

返回目录:excel表格制作


Sub 查找zhidao()
For Each rng In Range("a1:d3")
    If rng = 7 Then
        a = rng.Row
        b = rng.Column
    End If
Next
MsgBox "行号为" & a & "-" & "列号为" & b
End Sub


你问题有点不明确。。。。你先看看这

Sub cx()
    Dim astring
    For i = 2 To 10
        If Cells(i, 1) > 20 And Cells(i, 2) < 170 Then
            astring = astring & " " & i
        End If
    Next i
    MsgBox "第" & astring & "行符合条件"
End Sub

dim flag as boolean
flag=false
for i=1 to usedrange.rows.count
for j=1 to usedrange.columns.count
if cells(i,j)="Weight/Mt Contents" then
Rows(i+1).Insert Shift:=xlDown
Rows("1:"& i).Delete Shift:=xlUp
flag=true
exit for
end if
next j
if flag then exit for
next i

G2输入公式
=IF(LEFT(E2,4)*1=2002,"Yes","")
下拉
对G列进行自动筛选
将筛选结果直接复制粘贴到sheet2
删掉不要的列
即可

相关阅读

关键词不能为空
极力推荐

ppt怎么做_excel表格制作_office365_word文档_365办公网