Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
runtime error 9 subscript out of range | Excel Worksheet Functions | |||
runtime error 9 out of range subscript #2 | Excel Programming | |||
runtime error 9 out of range subscript | Excel Programming | |||
Runtime error 9 - Subscript out of Range | Excel Programming | |||
Runtime Error '9' Subscript out of range HELP | Excel Programming |