Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Macro in Formula

0 views
Skip to first unread message

Mark Ravenscroft

unread,
Apr 3, 2003, 6:30:33 AM4/3/03
to
Hi can anyone help

I want to put a macro in into a =if formula.

Example

=if(A1="y",Name of Macro,"",)

The macro i want to use, unhides certain rows!

Can not figure out how to use the Macro i want to unhide
certain rows if answer in A1 = Y.

any help appreciated.

J.E. McGimpsey

unread,
Apr 3, 2003, 8:14:17 AM4/3/03
to
Worksheet functions can only return values to their calling cells, they
can't call subs. Nor, if they could, would the subs be able to change
the environment, like hiding rows or formatting cells.

For that you need an event macro. One way:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Address(False, False) = "A1" Then
If Target.Text = "y" Then
'unhide your rows
End If
End If
End Sub

Put this in the worksheet code module.

If A1 is calculated instead, use the Worksheet_Calculate event. See

http://cpearson.com/excel/events.htm

for more


In article <052101c2f9d4$707edb20$a301...@phx.gbl>, Mark Ravenscroft

0 new messages