Y
YehWei
Hi,
I'm trying to implement the following, but just couldn't figure out why
I keep getting a runtime error 1004 on Unable to set FormulaArray
Property of the Range Class. Can anyone enlighten me please? Thanks!
Dim NumRows As Integer
Dim NumBins As Integer
Dim ICol As Integer
Dim IRow As Integer
Dim sRngCol As String
Dim sRngR As String
Dim sRngC As String
Dim sRngLot As String
For IRow = 2 To NumRows
For ICol = 1 To NumBins
sRngCol = "rngCol" & ICol + 4
sRngR = "R" & IRow
sRngC = "C" & ICol
sRngLot = sRngR & sRngC
ActiveSheet.Cells(IRow, ICol).FormulaArray = _
"=AVERAGE(IF(rngCol1='" & sRngLot & ",'" & sRngCol & "))"
Next ICol
Next IRow
I'm trying to implement the following, but just couldn't figure out why
I keep getting a runtime error 1004 on Unable to set FormulaArray
Property of the Range Class. Can anyone enlighten me please? Thanks!
Dim NumRows As Integer
Dim NumBins As Integer
Dim ICol As Integer
Dim IRow As Integer
Dim sRngCol As String
Dim sRngR As String
Dim sRngC As String
Dim sRngLot As String
For IRow = 2 To NumRows
For ICol = 1 To NumBins
sRngCol = "rngCol" & ICol + 4
sRngR = "R" & IRow
sRngC = "C" & ICol
sRngLot = sRngR & sRngC
ActiveSheet.Cells(IRow, ICol).FormulaArray = _
"=AVERAGE(IF(rngCol1='" & sRngLot & ",'" & sRngCol & "))"
Next ICol
Next IRow