LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
ron
 
Posts: n/a
Default How can I invoke running a macro from within an "IF" function.

I want to Hide a range of rows (16:18 in this example) if "no" is in a range
of cells and Unhide the same range of rows if "yes" is in the same range of
cells. The "Hide", "Unhide" macros (below) work if I select one from the Run
Macro list, of course. But, how can I call for it to run from an "IF"
function. I know this statement is wrong, but it may help you know what I am
looking for: =IF (A1:A15="no",Run Hide,IF (A1:A15="yes",Run Unhide),"")

Sub Hide()
'
' Hide Macro
'
Rows("16:18").Select
Selection.EntireRow.Hidden = True
End Sub
___________________
Sub Unhide()
'
' Unhide Macro
'
Rows("16:18").Select
Selection.EntireRow.Hidden = False
End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Restarting a macro BR Excel Worksheet Functions 19 December 23rd 05 09:57 PM
Function triggering a macro Leon Excel Worksheet Functions 1 December 22nd 05 07:26 AM
Running a macro for each item in an Autofilter list Andrew Excel Discussion (Misc queries) 1 August 19th 05 02:39 PM
How to CANCEL file SAVE PROMPT when MACRO is running? Stuart Macro Muppet Excel Discussion (Misc queries) 3 August 11th 05 12:26 PM
Function Macro for Nested IF Qaspec Excel Worksheet Functions 5 March 10th 05 07:25 PM


All times are GMT +1. The time now is 04:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"