View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Andyjim Andyjim is offline
external usenet poster
 
Posts: 70
Default Reactivating file based on text value producees subscript error

Hi-
I've gotten tremendous help from you before. I hope you can help me here.

I use the following code to reactivate an open file to which we don't know
the name, but the name exists in the form of text in a cell in the currently
active file called fxRM_Update.xls.
This code produces a subscript out of range error.

Sub Update2()
'Defines user file in fxRM_Update.xls
'Update macro calls this macro each time it must return to user file

Dim bk As Workbook, bk1 As Workbook
Dim sstr As String
Set bk = Workbooks("fxRM_Update.xls")
sstr = bk.Worksheets("lookup").Range("d39").Value
Set bk1 = Workbooks(sstr)
bk1.Activate

End Sub

I would be very grateful if you could help me.

Andy