Link to home
Start Free TrialLog in
Avatar of garethtnash
garethtnashFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Excel Copy Macro down foe each row

Hell All,

I have the macro below - which works fine on row 1, however I want it to run for every row that has data on it?

How do I do this?

Sub ConsolidateHours()
'
' ConsolidateHours Macro
' Consolidate Hours
'
' Keyboard Shortcut: Ctrl+Shift+H
'
    Range("AJ3:AJ" & Rows.Count).Select
    ActiveCell.FormulaR1C1 = "=SUM(RC[-27]+RC[-24]+RC[-21])"
    Range("AK3:AK" & Rows.Count).Select
    ActiveCell.FormulaR1C1 = "=SUM(RC[-19]+RC[-16])"
    Range("AL3:AL" & Rows.Count).Select
    ActiveCell.FormulaR1C1 = "=RC[-14]"
    Range("AM3:AM" & Rows.Count).Select
    ActiveCell.FormulaR1C1 = "=RC[-12]"
    Range("AN3:AN" & Rows.Count).Select
    ActiveCell.FormulaR1C1 = "=RC[-10]"
    Range("AO3:AO" & Rows.Count).Select
    ActiveCell.FormulaR1C1 = "=SUM(RC[-5]:RC[-1])"
End Sub

Open in new window


Thanks
ASKER CERTIFIED SOLUTION
Avatar of Rgonzo1971
Rgonzo1971

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of garethtnash

ASKER

Thank you All