Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 why Sub CalculateResults() 'this macro calculates the speeds and lengths of the vehicles If IsEmpty(Range("A6").Value) Then MsgBox "No Data" Exit Sub End If 'this is a fail safe to stop the macro if the sheet is empty With ActiveSheet.Range("E6:E" & .Cells(.Rows.count, "D").End(xlUp).Row).FormulaR1C1 _ = "=(R2C8/(RC[-3]-RC[-4]))*(3600/1609344)" End With 'this code inputs a formula into every cell in column e that has a coresponding value in row d With ActiveSheet.Range("f6:f" & .Cells(.Rows.count, "D").End(xlUp).Row).FormulaR1C1 _ = "=(R2C8/(RC[-2]-RC[-3]))*(3600/1609344)" End With 'as above but for column f With ActiveSheet.Range("g6:g" & .Cells(.Rows.count, "D").End(xlUp).Row).FormulaR1C1 _ = "=average(rc[-1]:rc[-2])" End With 'as above but for column g With ActiveSheet.Range("h6:h" & .Cells(.Rows.count, "D").End(xlUp).Row).FormulaR1C1 _ = "=((rc[-1]/(3600/1609344))*(((rc[-5]-rc[-7])+(rc[-4]-rc[-6]))/2))/1000" End With 'as above but for column h End Sub |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Try this
With ActiveSheet .Range("E6:E" & .Cells(.Rows.count, "D").End(xlUp).Row).FormulaR1C1 _ = "=(R2C8/(RC[-3]-RC[-4]))*(3600/1609344)" End With -- HTH Bob Phillips (remove nothere from email address if mailing direct) "ashw1984" wrote in message ... 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 why Sub CalculateResults() 'this macro calculates the speeds and lengths of the vehicles If IsEmpty(Range("A6").Value) Then MsgBox "No Data" Exit Sub End If 'this is a fail safe to stop the macro if the sheet is empty With ActiveSheet.Range("E6:E" & .Cells(.Rows.count, "D").End(xlUp).Row).FormulaR1C1 _ = "=(R2C8/(RC[-3]-RC[-4]))*(3600/1609344)" End With 'this code inputs a formula into every cell in column e that has a coresponding value in row d With ActiveSheet.Range("f6:f" & .Cells(.Rows.count, "D").End(xlUp).Row).FormulaR1C1 _ = "=(R2C8/(RC[-2]-RC[-3]))*(3600/1609344)" End With 'as above but for column f With ActiveSheet.Range("g6:g" & .Cells(.Rows.count, "D").End(xlUp).Row).FormulaR1C1 _ = "=average(rc[-1]:rc[-2])" End With 'as above but for column g With ActiveSheet.Range("h6:h" & .Cells(.Rows.count, "D").End(xlUp).Row).FormulaR1C1 _ = "=((rc[-1]/(3600/1609344))*(((rc[-5]-rc[-7])+(rc[-4]-rc[-6]))/2))/1000" End With 'as above but for column h End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
excel compile error. Only some computers? | Excel Discussion (Misc queries) | |||
compile error in hidden module: autoexecnew - how do I get rid? | Charts and Charting in Excel | |||
Compile error in hidden module | Excel Discussion (Misc queries) | |||
VBA Error Message "Compile Error...." | Excel Discussion (Misc queries) | |||
Compile error in hidden module: ThisWorkbook | Excel Discussion (Misc queries) |