I changed this to not give an error if it finds nothing, but to produce 0. Used for accumulating overtime, so very important you see.
Function PrevSheet(Range As Range) Application.Volatile PrevSheet = Application.Caller.Parent.Index If PrevSheet = 1 Then PrevSheet = 0 ElseIf Sheets(PrevSheet - 1).Type <> -4167 Then PrevSheet = CVErr(xlErrNA) Else PrevSheet = Sheets(PrevSheet - 1) _ .Range(Range.Address).Value End If End Function
Big thanks to
http://www.methodsinexcel.co.uk/Articles/one%20before.html
Tech Reference: Excel
Leave a Reply