close

the section of this code that say's
(.Rows.count
give's a compile error
but it never used to
i don't think i have changed anything
please can anybody tell me whySub CalculateResults()
'this macro calculates the speeds and lengths of the vehicles

If IsEmpty(Range(quot;A6quot;).Value) Then
MsgBox quot;No Dataquot;
Exit Sub
End If
'this is a fail safe to stop the macro if the sheet is empty

With ActiveSheet.Range(quot;E6:Equot; amp; .Cells(.Rows.count,
quot;Dquot;).End(xlUp).Row).FormulaR1C1 _
= quot;=(R2C8/(RC[-3]-RC[-4]))*(3600/1609344)quot;
End With
'this code inputs a formula into every cell in column e that has a
coresponding value in row d
With ActiveSheet.Range(quot;f6:fquot; amp; .Cells(.Rows.count,
quot;Dquot;).End(xlUp).Row).FormulaR1C1 _
= quot;=(R2C8/(RC[-2]-RC[-3]))*(3600/1609344)quot;
End With
'as above but for column f
With ActiveSheet.Range(quot;g6:gquot; amp; .Cells(.Rows.count,
quot;Dquot;).End(xlUp).Row).FormulaR1C1 _
= quot;=average(rc[-1]:rc[-2])quot;
End With
'as above but for column g
With ActiveSheet.Range(quot;h6:hquot; amp; .Cells(.Rows.count,
quot;Dquot;).End(xlUp).Row).FormulaR1C1 _
= quot;=((rc[-1]/(3600/1609344))*(((rc[-5]-rc[-7]) (rc[-4]-rc[-6]))/2))/1000quot;
End With
'as above but for column h

End Sub

Try this

With ActiveSheet
.Range(quot;E6:Equot; amp; .Cells(.Rows.count, quot;Dquot;).End(xlUp).Row).FormulaR1C1 _
= quot;=(R2C8/(RC[-3]-RC[-4]))*(3600/1609344)quot;
End With--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

quot;ashw1984quot; gt; wrote in message
...
gt; the section of this code that say's
gt; (.Rows.count
gt; give's a compile error
gt; but it never used to
gt; i don't think i have changed anything
gt; please can anybody tell me why
gt;
gt;
gt; Sub CalculateResults()
gt; 'this macro calculates the speeds and lengths of the vehicles
gt;
gt; If IsEmpty(Range(quot;A6quot;).Value) Then
gt; MsgBox quot;No Dataquot;
gt; Exit Sub
gt; End If
gt; 'this is a fail safe to stop the macro if the sheet is empty
gt;
gt; With ActiveSheet.Range(quot;E6:Equot; amp; .Cells(.Rows.count,
gt; quot;Dquot;).End(xlUp).Row).FormulaR1C1 _
gt; = quot;=(R2C8/(RC[-3]-RC[-4]))*(3600/1609344)quot;
gt; End With
gt; 'this code inputs a formula into every cell in column e that has a
gt; coresponding value in row d
gt; With ActiveSheet.Range(quot;f6:fquot; amp; .Cells(.Rows.count,
gt; quot;Dquot;).End(xlUp).Row).FormulaR1C1 _
gt; = quot;=(R2C8/(RC[-2]-RC[-3]))*(3600/1609344)quot;
gt; End With
gt; 'as above but for column f
gt; With ActiveSheet.Range(quot;g6:gquot; amp; .Cells(.Rows.count,
gt; quot;Dquot;).End(xlUp).Row).FormulaR1C1 _
gt; = quot;=average(rc[-1]:rc[-2])quot;
gt; End With
gt; 'as above but for column g
gt; With ActiveSheet.Range(quot;h6:hquot; amp; .Cells(.Rows.count,
gt; quot;Dquot;).End(xlUp).Row).FormulaR1C1 _
gt; = quot;=((rc[-1]/(3600/1609344))*(((rc[-5]-rc[-7]) (rc[-4]-rc[-6]))/2))/1000quot;
gt; End With
gt; 'as above but for column h
gt;
gt; End Sub

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()