Non-Sequential Array in Excel Macro

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • etangman
    New Member
    • Jul 2007
    • 6

    Non-Sequential Array in Excel Macro

    Hello people. This is quick and easy I just can't figure out the correct syntax. Help appreciated.

    I'm attempting to create an Excel macro that replaces cell contents on one sheet with a connecting formula to update it from another sheet. I am currently using very uneffective code, and it has worked, but I have recently encountered a few problems. More effective code would be much easier to manage.

    Currently I am using the following:

    Range("A2").Sel ect
    ActiveCell.Form ulaR1C1 = "='\\Rao_feed2\ Loss Graphs\[Loss Report.xls]BREAKERS'!R17C1 57"

    Range("A3").Sel ect
    ActiveCell.Form ulaR1C1 = "='\\Rao_feed2\ Loss Graphs\[Loss Report.xls]BREAKERS'!R17C1 53"

    Range("A4").Sel ect
    ActiveCell.Form ulaR1C1 = "='\\Rao_feed2\ Loss Graphs\[Loss Report.xls]BREAKERS'!R17C1 49"

    As you may notice the cells skip in intervals of 4. C157 - C153 - C149 etc. I'm thinking of trying to create a For 157 To 149 statement, but I don't know how to make it skip by 4's, only in numerical order. If anyone knows the syntax to make this transition it would be much appreciated. If I can make it skip by 4 I think I can figure the rest out.
    Last edited by etangman; Jul 12 '07, 03:41 PM. Reason: Understanding
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    See my response to your other post. In this case, since you're counting down rather than up, your For loop would need to use Step -4.

    Comment

    Working...