Quite by accident I have just found someone also having problems with the PrevSheet UDF, not only that they had a solution that works! It is at
(not sure if I got that right). Maybe my computer took pity on me and went looking on its own! ;-)
the code is:
Function PrevSheet(Rg As Range)
'accounts for more than one workbook open
'and has hidden sheets
'Bob Phillips October 4, 2009
Dim n As Variant
With Application.Caller.Parent
n = .Index
Do
If n = 1 Then
PrevSheet = CVErr(xlErrRef)
Exit Do
ElseIf TypeName(.Parent.Sheets(n - 1)) <> "Chart" And _
.Parent.Sheets(n - 1).Visible = xlSheetVisible Then
PrevSheet = .Parent.Sheets(n - 1).Range(Rg.Address).Value
Exit Do
End If
n = n - 1
Loop
End With
End Function
I have done a quick check and it seems to work as is. I just hope there is nothing lurking in some dark dank corner waiting to pop up and bite me in the bum!
Bookmarks