There is actually a fairly simple method of doing what you ask.
If you have Option Explicit turned on you will have to Dim
RowToDelete as an integer before using it. As well you have to make sure
that you substitute the name of the worksheet you are using for
FirstSheet. You can make the range "A1:A1000" anything you would like but
I suggest keeping it in a single column.
Not to confuse the issue but if you are calling the macro directly
from the affected worksheet there is an even easier way to do this. As
Continuing to prove there is more than one way to skin a cat (not to
offend cat lovers!) you can also try the following. It is essentially
the same as above but skips a step.
All this does is eliminate the step of separately figuring which row
Almost any function or formula that you can use in an Excel
Spreadsheet can be used in VBA5. Application.WorksheetFunction can be a
very powerful tool as witnessed by the brevity of the solution above as
compared to some of the others. Any macro that accomplishes its job is a
good one but usually the smaller the better.