• flickr
  • linkedin
  • twitter
  • rss
Value from previous sheet in Excel

Value from previous sheet in Excel

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)
PrevSheet = Application.Caller.Parent.Index

If PrevSheet = 1 Then
PrevSheet = 0
ElseIf Sheets(PrevSheet - 1).Type <> -4167 Then
PrevSheet = CVErr(xlErrNA)
PrevSheet = Sheets(PrevSheet - 1) _
End If
End Function

Big thanks to

Tech Reference:

Larry's a 30-something chap interested in travel, being a dork and changing the world via less boring training.

Leave a reply