I am trying to sum a column of data and I keep on getting an compile error. Expected. The formula I am trying to write is =C(iRw+1):C(iRw+16) to sum column C rows 1 - 16. I have highlighted the row that is giving me the problem. Any help would be apprecaited.
Code:
For Z = 1 To rst.RecordCount
With goXL.ActiveSheet
.Cells(iRw, 2).Value = "'" & (rst![mon_nm]) & " " & (rst![Yr])
.Cells(iRw, 3) = rst![1]
.Cells(iRw, 4) = rst![2]
.Cells(iRw, 5) = rst![3]
.Cells(iRw, 6) = rst![4]
'Excel formula =IF(ISBLANK(E5),0,F5/E5)
.Cells(iRw, 7).Formula = "=if(ISBLANK(E" & (iRw) & "),0,F" & (iRw) & "/E" & (iRw) & ")"
.Cells(iRw, 8) = rst![5]
.Cells(iRw, 9) = rst![6]
.Cells(iRw, 10) = rst![7]
'Excel Formula =IF(ISBLANK(D5),0,I5/D5)
.Cells(iRw, 11).Formula = "=if(ISBLANK(D" & (iRw) & "),0,I" & (iRw) & "/D" & (iRw) & ")"
'Excel Formula =IF(ISBLANK(F5),0,I5/F5)
.Cells(iRw, 12).Formula = "=if(ISBLANK(F" & (iRw) & "),0,I" & (iRw) & "/F" & (iRw) & ")"
'Excel Formula =IF(ISBLANK(I6),0,I6/H6)
.Cells(iRw, 13).Formula = "=if(ISBLANK(I" & (iRw) & "),0,I" & (iRw) & "/H" & (iRw) & ")"
'=IF((I6+J6)=0,0,I6/(I6+J6))
.Cells(iRw, 14).Formula = "=IF((I" & (iRw) & "+J" & (iRw) & ")=0,0,I" & (iRw) & "/(I" & (iRw) & "+J" & (iRw) & "))"
.Cells(iRw, 15) = rst![8]
'Excel Formula =IF(ISBLANK(O6),=O6/(AA6/AB6)
.Cells(iRw, 16).Formula = "=if(ISBLANK(O" & (iRw) & "),0,O" & (iRw) & "/(AA" & (iRw) & "/AB" & (iRw) & "))"
'Sum of column B for totals
'=C(iRw+1):C(iRw+16)
[Red] .Cells(iRw, 17).Formula = ((C" &(iRw) &"+1)" & ":" & "C" &(iRw) "&" "+16"))[/Red]
.Cells(iRw, 27) = rst![9]
.Cells(iRw, 28) = Daysper3Mon(rst![rptpd])
End With
rst.MoveNext
iRw = iRw + 1
If Not rst.EOF Then