none
vba code RRS feed

  • Question

  • hi frds,i have data in SHEET1 serial numbers 1 to 10 in COLUMN A corresponding names in COLUMN B...

    i hvae data in SHEET2 1 3 5 7 9 2 4 6 8 10 in COLUMN A and corresponding phone numbers

    i want to output of SHEET3 COLUMN B 10 9 ......1 along woth corespong phone numbers

    how can do apporch.....pls help me

    Friday, February 21, 2014 1:51 AM

All replies

  • Look at the VLOOKUP worksheet function in Excel help. It will let you look up the phone number given the serial number.

    No need for VBA code.


    Rod Gill
    Author of the one and only Project VBA Book
    www.project-systems.co.nz

    Friday, February 21, 2014 2:39 AM
  • can u pls write code....

    sheet1                               sheet2                                           output sheet3       


    columna column b               column a   column b                      column b   column c

    1             ramesh                     1            128                                 10            984

    2              dsafllf                       3            567                                  9             478

    3             fgfgfggf                      5            489                                  8             123

    4             fgfgffgf                       7            987                                  7             987

    5            f;gfg;ggf'                     9            478                                  6             345

    6            fdfflflfkfl                       2             678                                 5             489

     7           dsddasds                    4            156                                  4              156

    8             dskdskds                   6             345                                  3              567

    9            dskds                         8             123                                  2              678

    10          dskdskdsk                  10           984                                  1             127



    Friday, February 21, 2014 3:11 AM
  • Sub Main()
    Dim i As Integer
    Dim j As Integer
    Dim k As Integer
    k = 1
    For i = 10 To 1
        For j = 1 To 10
            If Sheet1.Cells(i, 1) = Sheet2.Cells(j, 1) Then
                Sheet3.Cells(k, 1) = Sheet1.Cells(i, 1)
                Sheet3.Cells(k, 2) = Sheet2.Cells(j, 2)
                k = k + 1
            End If
        Next j
    Next i
    End Sub



    VBA Programming Service
    • Edited by Pedrumj2 Sunday, February 23, 2014 9:18 AM
    Sunday, February 23, 2014 8:34 AM