Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Need some help with a simple Excel Macro  (Read 1062 times)

0 Members and 1 Guest are viewing this topic.

kwfine

    Topic Starter


    Intermediate
    Need some help with a simple Excel Macro
    « on: June 13, 2008, 02:46:19 PM »
    Good morning all,

    I am learning how to write a simple Macro program in Excel:

    A                B                 C
    ===         ===             ===
    Jame        Apple           Apple
    Tom         Orange         Apple
    David       Apple           Apple

    -------------------------------------------
    Here is the code:

    Sub testing()
    For N = 1 to 3
    If cells(N,2).value=cells(N,3).value Then
    Range(corresponding-value).copy
    Range(corresponding-value).pastespecial
    End IF
    Next
    End Sub
    ------------------------------------------------------------------------

    The program will copy specific rows
    when the cells in colum  B equals those in column C,
    and then it will paste the specific rows of data somewhere in the same worksheet.
    The program works but it returns empty cells.
    Here is what the result looks like:
    =====
    Jame
    Empty cell
    David
    =====

    Is there any method to skip the empty cells?

    Please kindly help if you could!

    Kitty


    P.S. I am using Excel 2002
    « Last Edit: June 13, 2008, 02:57:33 PM by kwfine »