Macro within a formula

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

can you somehow run a macro automatically from a formula with a specific criteria? Basically having a macro run by itself if a formula's criteria is met. I have a macro assigned to an active X control to copy formulas when I click it. My problem is when I delete a row of data and click on the active X control, there is an extra row of formula's copied because I have removed one. My idea was to have a formula determine whether or not there was to many formulas and then have a macro run automatically to delete that extra row if that was the case. Any ideas?
 
You can't have a macro run by being called from a worksheet formula.

But there are worksheet events that could help.

There's a worksheet_change event that looks for typing changes by the user.
There's a worksheet_selectionchange that looks for the user selecting a
different range. And there's a worksheet_calculate event that fires when the
worksheet is calculated.

But I'm not sure how that would help. If you could figure out how many rows
there are in one of those events, then I would guess that you could do the same
based on the click of your control.

You may want to post a few more details (not a workbook) to get a better
response.
 
Back
Top