问个VBA的有关问题

fieldset{padding:10px;}

问个VBA的问题有两列数,求列中值相同的项,并返回。假设第一列和第二列中都有9,最后结果也返回9。用什么函数公式?12881148697755992139614482465894846——解决方案——————————————————–在你的 Excel文档中插入一个标准模块,粘贴下面的代码,运行试这个 Sub 试一下:VB code

Option ExplicitSub Test()    Dim a$(), i&, k&, p&, txt$    Dim objSht As Worksheet        Set objSht = Sheets("Sheet1")   '数据在 Sheet1 中    k = 2   '数据起始行为 2    ReDim a(WorksheetFunction.CountA(objSht.Range("A:A")) - 1)    p = -1    i = k: Do        txt = objSht.Cells(i, 2)        If (txt = "") Then Exit Do        p = p + 1: a(p) = txt        i = i + 1    Loop    i = k: Do        txt = objSht.Cells(i, 1)        If (txt = "") Then Exit Do        For k = 0 To p            If (txt = a(k)) Then                objSht.Cells(i, 3) = txt                Exit For            End If        Next        i = i + 1    LoopEnd Sub一个真正的人对困难的回答是战斗,

问个VBA的有关问题

相关文章:

你感兴趣的文章:

标签云: