View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default UDF won't launch macro

This is all you need then. It will run the macro if you select cell A2 and
A1 is True

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Me.Range("A1") Then Call Reset_Rev5_Col_2_TypeB
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.
--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"hdf" wrote in message
ps.com...
Bob,

I'm not sure what you mean by event code.

If I understand your questions, the condition is when the value of a
given cell input as the variable of my new UDF = TRUE launching (or
trying to) a macro that clears and repopulates a named range, as
follows:

cell: A1 = True
cell: A2 =Launchmacro(a1)

If it worked like I had intended it to, when A1 = TRUE it would run
the macro code below. I really don't care what value is put into cell
A2 since my objective is to get the model to run the macro when
A1=TRUE
__________

Sub Reset_Rev5_Col_2_TypeB()

Range("test_clear") = Clear
With Range("test_clear")
.Rows(1).Select
.value = 0
.Font.ColorIndex = 5
End With

With Range("test_clear_col")
.FormulaR1C1 = "=r[-1]c"
.Font.ColorIndex = 1
End With

Application.Goto Reference:="Start"


End Sub
_________