LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default runtime error 9 -- subscript out of range

Hi

I am getting runtime error 9 - subscript out of range for following code...

This code is basically pasting values to 'UK - SI - CHT' sheet from an array.

the ubound value of the array is 55000, it is successfully pasting 2425
records but then giving 'runtime error 9 -- subscript out of range'

Wat could be the reason??? Please help...


vUKOnlyXLReport = "SI CtS May-08 UK Only - detail plus graphs CCI%.xls"
Workbooks.Open (vGlobalReportPath & vUKOnlyXLReport)
Workbooks(vUKOnlyXLReport).Worksheets("UK - SI - CHT").Activate
vMatch = "Systems Integration & TechnologySystems IntegrationUK,
IrelandUnited KingdomCommunications & High Tech"

Dim iR As Long
Dim iRow As Long

iR = 2
For iRow = 2 To UBound(vaGrowthPlatform)
If vMatch = vaGrowthPlatform(iRow) & vaServiceGroup(iRow) &
vaGeography(iRow) & vaGeoCity(iRow) & vaOG(iRow) Then
Workbooks(vUKOnlyXLReport).Worksheets("UK - SI - CHT").Range("A"
& iR).Value = vaWorkforce(iRow)
Workbooks(vUKOnlyXLReport).Worksheets("UK - SI - CHT").Range("B"
& iR).Value = vaOG(iRow)
Workbooks(vUKOnlyXLReport).Worksheets("UK - SI - CHT").Range("C"
& iR).Value = vaGeography(iRow)
Workbooks(vUKOnlyXLReport).Worksheets("UK - SI - CHT").Range("D"
& iR).Value = vaGeoCity(iRow)
Workbooks(vUKOnlyXLReport).Worksheets("UK - SI - CHT").Range("F"
& iR).Value = vaSumOfhours_total_ytd(iRow)
Workbooks(vUKOnlyXLReport).Worksheets("UK - SI - CHT").Range("G"
& iR).Value = vagdn_locale_cd(iRow)
Workbooks(vUKOnlyXLReport).Worksheets("UK - SI - CHT").Range("H"
& iR).Value = vamstr_client_name(iRow)
Workbooks(vUKOnlyXLReport).Worksheets("UK - SI - CHT").Range("I"
& iR).Value = vamstr_contract_nbr(iRow)
Workbooks(vUKOnlyXLReport).Worksheets("UK - SI - CHT").Range("J"
& iR).Value = vamstr_contract_name(iRow)
Workbooks(vUKOnlyXLReport).Worksheets("UK - SI - CHT").Range("K"
& iR).Value = vawbselement_cd(iRow)
Workbooks(vUKOnlyXLReport).Worksheets("UK - SI - CHT").Range("L"
& iR).Value = vawbselement_desc(iRow)

Workbooks(vUKOnlyXLReport).Worksheets("UK - SI - CHT").Range("T"
& iR).Value = vaSumOfcosts_payroll_ytd(iRow)
Workbooks(vUKOnlyXLReport).Worksheets("UK - SI - CHT").Range("U"
& iR).Value = vaSumOfcosts_loads_ytd(iRow)
Workbooks(vUKOnlyXLReport).Worksheets("UK - SI - CHT").Range("V"
& iR).Value = vaSumOfcosts_seat_charges_ytd(iRow)

SumofYTDLoadedcosts = (vaSumOfcosts_payroll_ytd(iRow) +
vaSumOfcosts_loads_ytd(iRow) + vaSumOfcosts_loads_ytd(iRow))

If vaSumOfhours_total_ytd(iRow) < 0 Then
CtS = SumofYTDLoadedcosts / vaSumOfhours_total_ytd(iRow)
Else
CtS = ""
End If

Workbooks(vUKOnlyXLReport).Worksheets("UK - SI - CHT").Range("E"
& iR).Value = SumofYTDLoadedcosts
Workbooks(vUKOnlyXLReport).Worksheets("UK - SI - CHT").Range("M"
& iR).Value = CtS

iR = iR + 1
End If
Next iRow

Workbooks(vUKOnlyXLReport).Close SaveChanges:=True


Thanks!!
Milind
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
runtime error 9 subscript out of range Nastack628 Excel Worksheet Functions 1 February 2nd 12 08:41 PM
runtime error 9 out of range subscript #2 Janis Excel Programming 6 August 20th 07 09:56 PM
runtime error 9 out of range subscript Janis Excel Programming 1 August 20th 07 06:34 PM
Runtime error 9 - Subscript out of Range Joe Saunders Excel Programming 3 July 26th 07 09:52 AM
Runtime Error '9' Subscript out of range HELP Brandon Johnson Excel Programming 1 August 2nd 06 06:46 PM


All times are GMT +1. The time now is 12:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"