A formula can't call a macro that will do that. You would use the Calculate
event
http://www.cpearson.com/excel/events.htm for an overview
Right click on the sheet tab
Select view code
In the left dropdown at the top of the resulting module select worksheet and
from the left dropdown select Calculate
Private Sub Worksheet_Calculate()
Dim lastrow as Long
set lastrow = cells(rows.count,2).end(xlup).row
for i = lastrow to 2 Step -1
if application.countA(cells(i,"B"),cells(i,"D"),cells (i,"E")) < 0 and _
application.CountA(cells(i-1,"B"),cells(i-1,"D"),cells(i-1,"E")) < 0 then
if cells(i,"B") < cells(i-1,"B") or cells(i,"D") < cells(i-1,"D") _
or cells(i,"E") < cells(i-1,"E") then
rows(i).EntireRow.Insert
End if
end if
Next
End sub
--
Regards,
Tom Ogilvy
"Emajination" wrote:
I need to have a formula that checks each row in a spreadsheet and
compares the values in columns B, D, E. If the values in the all three
columns are the same, no action is required. If the value in all three
columns changes, a blank row should be inserted between the lines that
differ. So it sounds like i need a formula to do the comparison that
will call in a macro to do the row insertion when it applies.
Thank you in advance