View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
 
Posts: n/a
Default custimise the "IF" formula function

Thanks for all the replies.

Unfortunately i was wanting to do this as a UDF rather than just
putting the formula into VBA and working it out with a macro.

I have a workbook that is too complex to go into detail with, but
basically in an example:
If i enter a value into cell A1, i want SOME of the formulas in a
certain column (say B) to wait 2 secs before displaying their results.
These formulas are NOT all the same. That is why i was hoping to have
a customised IF function.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.address = "$A$1" Then
Application.Wait (Now + TimeValue("00:00:02"))
End If
End Sub

This is where i was going to get the delay from, and

Function timedelay(Delay_IF As String, If_True As String, If_False As
String)
Dim x As Range
Set x = Application.Caller
If x.Column = 2 Then

'x.Value = "=IF(" & Delay_IF & "," & IfTrue & "," & If_False & ")"
End If
End Function

This is the function i did not know how to complete. Just wanted this
to act exactly the same as the worksheet IF function

rather than having =IF(A1<"","YES","NO")
i would have =timedelay(A1<"","YES","NO")

The only thing all the formulas that i want delayed have in common is
that they start with an IF formula

thanks again
George