Subtotal Format with Macro

  • Thread starter Thread starter Juan
  • Start date Start date
J

Juan

Hello,
I want to do a Subtotal in excel and I want to create a
macro to format the cell that contains the subtotal
formula, my problem is that my file might change so if I
specified in my macro Cell A12 to format, but my Subtotal
might not be there might be in A14 depending if there's
more data in the file. So want to do my macro to format
cells that have the Subtotal formula.

Any help would be very appreciated,

thanks,
juan
 
You can give a name to the cell which contains the subtotal (i.e. : toto
Menu : Insert > Name > Define..
Then in your code you can refer it with its nam
in VBA : Me.Range("toto").valu
in Excel formula : =IF(toto=0,"-","OK"

If you want to format a cell, you can use the "Conditional Formatting", it's quicker than VBA macr
Menu : Format > Conditional Formatting..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top