Simple Copy Adjacent Cell if This Cell is Equal To "x" (vba)

  • Re: Simple Copy Adjacent Cell if This Cell is Equal To "x" (vba)


    [vb] c = 9 '//by default array column # 9(for K)
    If v = "J" Then
    '//if it's J, col # is 8
    c = 8
    '//v=search value(0)
    v = 0
    Else
    '//v=search value("L")
    v = "L"
    End If

    For i = 1 To UBound(k, 1)
    If k(i, c) = v Then '//in the array check the search value(variables already set above)
    Dest.Value = k(i, 1) '//if found, write in the destination cell. set the dest cell 1 row below
    Set Dest = Dest.Offset(1)
    End If
    Next[/vb]