View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Heera Heera is offline
external usenet poster
 
Posts: 98
Default Run time error 9 (Subscript Out Of Range)

Hi,

I am writing a macro for a report.

I need to navigate from one report to an another report to collect the
data. My macro gets stuck-up on this paticular code every time. (Run
time error 9, Subscript Out Of Range)

Windows("Hiring Plan.xls").Activate

I have also tried other alternatives as well. For example but
Workbooks("Hiring Plan.xls").Sheets("C LLC").Range("A2").Activate

I dont understant why it is happening. Please help.

Private Sub RamPlan()

Workbooks("Ramp Plan Macro.xls").Activate
Sheets("Macro").Select

Dim hirePath As String
Dim ramppath As String
Dim hirename As String
Dim rampName As String

hirePath = Range("c8").Value
ramppath = Range("c9").Value
hirename = Range("c10").Value
rampName = Range("c11").Value


Workbooks.Open ramppath & "\" & rampName
Workbooks.Open hirePath & "\" & hirename

Dim fromdate As Variant
fromdate = Workbooks("Ramp Plan
Macro.xls").Sheets("Macro").Range("c13").Value
Windows("Hiring Plan.xls").Activate

Do Until ActiveCell.Value = fromdate
Selection.Offset(1, 0).Select
Loop

Selection.Offset(0, 5).Select
If ActiveCell.Value = "" Then
Call CCTTrainer
End If

End Sub