Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Runtime error '9'subscript out of range

  Asked By: Mali    Date: Aug 22    Category: MS Office    Views: 1418
  

I have a macro runing perfect on my computer. However, my co-worker
had the "Runtime error '9' subscript out of range" problem when he
tried to run the same macro on his computer. Here is part of the code

Dim curwb As Workbook
Dim curws As Worksheet
Dim theRow As Range

Dim rbary As Integer
Application.defaultFilePath = CurDir()
Set curwb = Workbooks("weekly report ACM BTO")
Set curws = curwb.Sheets("DPPM's 06")
curws.Activate
ActiveCell.CurrentRegion.Select

Set theRow = curws.Range("A4").CurrentRegion

ttlRow = theRow.Rows.Count
ReDim Preserve partNum(0 To ttlRow)

When I clicked Debug, the line

Set curwb = Workbooks("weekly report ACM BTO")

was highlighted. I had the ("weekly report ACM BTO") opened before I
run the code. Could anyone tell me what the problem is?

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Haboos Kauser     Answered On: Aug 22

Try

Set curwb = Workbooks("weekly report  ACM BTO.xls")

 
Didn't find what you were looking for? Find more on Runtime error '9'subscript out of range Or get search suggestion and latest updates.




Tagged: