View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Looking to see if Workbook is open

Dim oWB As Workbook

On Error Resume Next
Set oWB = Workbooks("myBook")
On Error GoTo 0
If oWB Is Nothing Then
Set oWB = Workbooks.Open("C:\myDir\myBook.xls")
End If
oWB.Worksheets("Sheet1").Activate


--

HTH

RP
(remove nothere from the email address if mailing direct)


"caldog" wrote in message
...
I am trying to write VBA code that will look first to see if another

workbook
is open, if open then go to sheet 1, if not open, then open it and go to
sheet 1.

You see I might need to go to this sheet several different times during

the
day and I don't want to keep opening and closing the sheet.

Steve