BarefootPaul
Board Regular
- Joined
- Jul 21, 2011
- Messages
- 54
I am trying to create a UDF based on this UDF that I found on the internet somewhere:
I have been typing out:
=If(0=RefOnPrevSheet("A1"),"", RefOnPrevSheet("A1"))
I tried writing it as:
but I get a circular reference error.
Any help is greatly appreciated.
Code:
Function RefOnPrevSheet(Addr As String) As Variant
Application.Volatile True
With Application.Caller.Parent
If .Index = 1 Then
RefOnPrevSheet = _
.Parent.Worksheets(.Parent.Worksheets.Count).Range(Addr).Value
Else
RefOnPrevSheet = .Previous.Range(Addr).Value
End If
End With
End Function
I have been typing out:
=If(0=RefOnPrevSheet("A1"),"", RefOnPrevSheet("A1"))
I tried writing it as:
Code:
Function IfPrevBlank(Addr As String) As Variant
IfPrevBlank = Application.If(0=RefOnPrevSheet(Addr), "", RefOnPrevSheet(Addr))
End Function
but I get a circular reference error.
Any help is greatly appreciated.