View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Lilivati
 
Posts: n/a
Default subscript out of range error in excell


Ardus Petus wrote:
Try:
Set mlUsed = Workbooks(nassisfile).Worksheets(2).Range("C:D")
in order to access to value of variable nassisfile

HTH
--
AP


I tried that, and it still gives me the same error. It is like it is
somehow not remembering the variable.

If I ask a message box to display the value of nassisfile, the first
time I try to change a cell it will display the name, and give me the
error. The next time I try it the message box is blank (it has lost
all touch with the variable nassisfile).

I tried replacing my first code with:

Public modelfile As String
Public nassislist As String

Public Sub Workbook_Open()
modelfile = ThisWorkbook.Name
nassisfile = "masterlist.xls"
End Sub


just as a way of bugtesting, since the value of nassisfile must
ultimately be defined by the user. The same error results.