Can I add my own function to the customized status bar in Excel? -
if select number of cells in excel, can see functions on in customized status bar. information own selection out of following:
- average
- count
- numerical count
- minimum
- maximum
- sum
i want add list function calculates ratio of non-blank cells. function =counta(range) / (counta(range) + countblank(range)), how can status bar? don't have experience in vba, explanation welcome.
try (not best way though solves purpose)
explanation: code checks if user has selected valid range (of minimum 2 cells) , uses application.evaluate
calculate formula , display in status bar. note have not done error handling. sure take care of :)
paste in relevant sheet code area.
private sub worksheet_selectionchange(byval target range) if typename(target) = "range" if target.cells.count > 1 application.statusbar = "my function: " & _ application.evaluate( _ "=counta(" & _ target.address & _ ") / (counta(" & _ target.address & _ ") + countblank(" & _ target.address & _ "))" _ ) end if end if end sub
this basic way of doing it. in case want applicable sheets have amend accordingly.
also problem method suppress application level messages in status bar.
screenshot
Comments
Post a Comment