Link to home
Start Free TrialLog in
Avatar of Jagwarman
Jagwarman

asked on

Loop Code

I have the below code which I need to copy 23 times
Range("G5").Select
    ActiveCell.FormulaR1C1 = "='Data Dashboard'!R[1]C[1]"
    ActiveCell.Offset(1, 0).Select
    ActiveCell.FormulaR1C1 = "='Data Dashboard'!R[1]C[1]"
    etc
      etc

then offset by 5 and do the next piece of code 23 times

ActiveCell.Offset(5, 0).Select
    ActiveCell.FormulaR1C1 = "='Data Dashboard'!R[-26]C[3]"
    ActiveCell.Offset(1, 0).Select
    ActiveCell.FormulaR1C1 = "='Data Dashboard'!R[-26]C[3]"

Instead of copying this code 23 times for each can an expert show me how to loop this please.
ASKER CERTIFIED SOLUTION
Avatar of Professor J
Professor J

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 Jagwarman
Jagwarman

ASKER

both excellent solutions but EE forces us to put one as 'Best Solution'