rfletcher35
Active Member
- Joined
- Jul 20, 2011
- Messages
- 300
- Office Version
- 365
- Platform
- Windows
Hey guys,
Trying to do something here that I have done a few times now but I cannot explain results, my code defines "lngLastRow", as I step through the code it clearly shows that it sees row 97 as the last row. However when executing this code it fills down to 397. I have double checked that there is no other data in Column A, all the way along it reports 97 as the last line but every time it completes it take the fill down to 397?
Dim lngLastRow As Long
Sheets("January").Select
lngLastRow = Range("A" & Rows.Count).End(xlUp).Row
'Formula's Month
Range("CS3").Select
ActiveCell.FormulaR1C1 = _
"=TIME(HOUR(RC[-93]),MINUTE(RC[-93]), SECOND(RC[-93]))"
Range("CT3").Select
ActiveCell.FormulaR1C1 = _
"=TIME(HOUR(RC[-88]),MINUTE(RC[-88]), SECOND(RC[-88]))"
Range("CU3").Select
ActiveCell.FormulaR1C1 = "=RC[-1]-RC[-2]"
Range("CV3").Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[-1]<'Stats Data'!R31C4,""Excellent"",IF(RC[-1]<'Stats Data'!R30C4,""Good"",IF(RC[-1]<'Stats Data'!R29C4,""Acceptable"",""Poor"")))"
Range("CS3:CV3").Select
Selection.AutoFill Destination:=Range("CS3:CV3" & lngLastRow), Type:=xlFillDefault
'Selection.AutoFill Destination:=Range("CS3:CV3" & Range("A" & Rows.Count).End(xlUp).Row)
'Range(Selection, Selection.End(xlDown)).Select
Please someone help, what am I doing wrong here?
Thanks
Fletch
Trying to do something here that I have done a few times now but I cannot explain results, my code defines "lngLastRow", as I step through the code it clearly shows that it sees row 97 as the last row. However when executing this code it fills down to 397. I have double checked that there is no other data in Column A, all the way along it reports 97 as the last line but every time it completes it take the fill down to 397?
Dim lngLastRow As Long
Sheets("January").Select
lngLastRow = Range("A" & Rows.Count).End(xlUp).Row
'Formula's Month
Range("CS3").Select
ActiveCell.FormulaR1C1 = _
"=TIME(HOUR(RC[-93]),MINUTE(RC[-93]), SECOND(RC[-93]))"
Range("CT3").Select
ActiveCell.FormulaR1C1 = _
"=TIME(HOUR(RC[-88]),MINUTE(RC[-88]), SECOND(RC[-88]))"
Range("CU3").Select
ActiveCell.FormulaR1C1 = "=RC[-1]-RC[-2]"
Range("CV3").Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[-1]<'Stats Data'!R31C4,""Excellent"",IF(RC[-1]<'Stats Data'!R30C4,""Good"",IF(RC[-1]<'Stats Data'!R29C4,""Acceptable"",""Poor"")))"
Range("CS3:CV3").Select
Selection.AutoFill Destination:=Range("CS3:CV3" & lngLastRow), Type:=xlFillDefault
'Selection.AutoFill Destination:=Range("CS3:CV3" & Range("A" & Rows.Count).End(xlUp).Row)
'Range(Selection, Selection.End(xlDown)).Select
Please someone help, what am I doing wrong here?
Thanks
Fletch