View Single Post
  #1   Report Post  
Angol
 
Posts: n/a
Default can anyone help with repeating the same action on different ranges?

I need to perform an operation on several long series of data:

Application.Run "ATPVBAEN.XLA!Regress", ActiveSheet.Range("F2:F251"),
ActiveSheet.Range("C2:C251"), False, False, ,
ActiveSheet.Range("AM21"), False, False, False, False, , False.

This works fine on an single data set.

And I'm able to generate the thousand or so sets of addresses -
F3:F252,C3:C252,AM41, etc. that I need. Unsurprisingly, though,
VBA/Excel protests that if I copy a thousand lines like that into a
macro I get a procedure that is is too large.

The elegant way to do what I want is to instruct Excel to perform the
regression, and then move one line down in a lookup table to change the
references and then run it again.

Long ago I recorded macros in Lotus123 that would pick up an
instruction to go, e.g. 1 line down and repeat something we'd done
before and I vaguely understand what the structure of what I need would
look like.

Can anyone advise me as to what I should be doing?