On Error Resume Next
Set oWb = Workbooks("September.xls")
If oWb Is Nothing Then
Set oWb = Workbooks.Open Filename:= _
"\\Statistics\Year 05-06\September.xls"
Endf If
On Error Goto 0
oWb.Activate
--
HTH
RP
(remove nothere from the email address if mailing direct)
"Steve" <crankylemming@aol.com> wrote in message
news:1124265562.992989.309810@z14g2000cwz.googlegroups.com...
> Hi
>
> I have the following code set to a commandbutton:
>
> Workbooks.Open Filename:= _
> "\\Statistics\Year 05-06\September.xls"
>
> However, if the sheet is already open in the background, I get an error
> message. What can I add to this code so that, if the sheet is already
> open, it just switches over to it?
>
> TIA
>
> Steve
>
Bookmarks