P
PT91745
below code works on Window 2000/Excel2000, but when upgrade to XP/Excel
2003 it failed with Subscript out of range: Please help. Thanks.
Codes first read workbook sheet(2), get the data, then try to find summary
sheet(1) with the same mfg header's column index, then back to sheet(2) keep
processing
For licnt = 1 To UBound(orsMfg_Name)
oricolindex = 1
oriRowIndex = oriRowIndex + 1
objSheet(lisheetno).Range("A" & oriRowIndex) =
orsMfg_Name(licnt).tName
'search to see which column on summary sheet for this mfg
Set oriSearch = objSheet(1).Range("A10:IV11").Find(orsMfg_Name
(licnt).tName, LookIn:=xlValue) ---> Abend here on subscript out of
range
If Not oriSearch Is Nothing Then
lisumcol = oriSearch.Column
Set oriSearch = Nothing
End If
oricolindex = oricolindex + 7
Do While oricolindex <= oriTotalCols
objSheet(lisheetno).Range(frfColName(oricolindex) &
oriRowIndex).Formula = "=SUMIF($G$" _
& orirowstart & ":$G$" & orirowend & "," & """" & "=" &
orsMfg_Name(licnt).tName _
& """" & "," & frfColName(oricolindex) & orirowstart _
& ":" & frfColName(oricolindex) & orirowend & ")"
objSheet(lisheetno).Range(frfColName(oricolindex) &
oriRowIndex).NumberFormat = "##,##0_);[Red](##,##0)"
oricolindex = oricolindex + 1
Loop
objSheet(1).Range(frfColName(lisumcol) & orisumrow +
lisheetno).Formula = "=+" & Chr(39) & objSheet(lisheetno).Name & Chr(39) &
"!" & frfColName(oriTotalCols) & oriRowIndex
objSheet(1).Range(frfColName(lisumcol) & orisumrow +
lisheetno).NumberFormat = "##,##0_);[Red](##,##0)"
Next licnt
2003 it failed with Subscript out of range: Please help. Thanks.
Codes first read workbook sheet(2), get the data, then try to find summary
sheet(1) with the same mfg header's column index, then back to sheet(2) keep
processing
For licnt = 1 To UBound(orsMfg_Name)
oricolindex = 1
oriRowIndex = oriRowIndex + 1
objSheet(lisheetno).Range("A" & oriRowIndex) =
orsMfg_Name(licnt).tName
'search to see which column on summary sheet for this mfg
Set oriSearch = objSheet(1).Range("A10:IV11").Find(orsMfg_Name
(licnt).tName, LookIn:=xlValue) ---> Abend here on subscript out of
range
If Not oriSearch Is Nothing Then
lisumcol = oriSearch.Column
Set oriSearch = Nothing
End If
oricolindex = oricolindex + 7
Do While oricolindex <= oriTotalCols
objSheet(lisheetno).Range(frfColName(oricolindex) &
oriRowIndex).Formula = "=SUMIF($G$" _
& orirowstart & ":$G$" & orirowend & "," & """" & "=" &
orsMfg_Name(licnt).tName _
& """" & "," & frfColName(oricolindex) & orirowstart _
& ":" & frfColName(oricolindex) & orirowend & ")"
objSheet(lisheetno).Range(frfColName(oricolindex) &
oriRowIndex).NumberFormat = "##,##0_);[Red](##,##0)"
oricolindex = oricolindex + 1
Loop
objSheet(1).Range(frfColName(lisumcol) & orisumrow +
lisheetno).Formula = "=+" & Chr(39) & objSheet(lisheetno).Name & Chr(39) &
"!" & frfColName(oriTotalCols) & oriRowIndex
objSheet(1).Range(frfColName(lisumcol) & orisumrow +
lisheetno).NumberFormat = "##,##0_);[Red](##,##0)"
Next licnt