Computer Hope

Software => Computer software => Topic started by: kwfine on June 13, 2008, 02:46:19 PM

Title: Need some help with a simple Excel Macro
Post by: kwfine 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