For i = Worksheets.Count To 1 Step - 1

If Worksheets(i).Visible Then
Worksheets(i).Activate
Exit For
End If

Next