首页 > 其他分享 >vba-在某列上查找数据放回所有的列和行

vba-在某列上查找数据放回所有的列和行

时间:2022-12-21 13:55:58浏览次数:48  
标签:vba 某列 Cells Value strFirst Chr 列和行 rngFound Row

    Dim rngFound As Range
    Dim strFirst As String
    Set rngFound = DataMatchSht.Columns("B").Find("CNH MXI", Cells(Rows.Count, "B"), xlValues, xlWhole)
    If Not rngFound Is Nothing Then
        strFirst = rngFound.Address
        Do
             
                'Found a match
                Debug.Print "Found a match at: " & rngFound.Row & Chr(10) & _
                       "Value in column C: " & Cells(rngFound.Row, "C").Value & Chr(10) & _
                       "Value in column D: " & Cells(rngFound.Row, "D").Value
            
            Set rngFound = Columns("CNH MXI").Find(strID, rngFound, xlValues, xlWhole)
        Loop While rngFound.Address <> strFirst
    End If

 

标签:vba,某列,Cells,Value,strFirst,Chr,列和行,rngFound,Row
From: https://www.cnblogs.com/Insist-Y/p/16996074.html

相关文章