+ Reply to Thread
Results 1 to 3 of 3

Second appeal for help-elegant way to do

  1. #1
    Angol
    Guest

    Second appeal for help-elegant way to do

    I need to perform an operation on several long series of data. It 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?

    PS. This repeats an earlier appeal for help that sadly went unanswered.
    The operation I'm performing is
    Application.Run "ATPVBAEN.XLA!Regress", ActiveSheet.Range("F2:F251"),
    ActiveSheet.Range("C2:C251"), False, False, ,
    ActiveSheet.Range("AM21"), False, False, False, False, , False.


  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good evening Angol

    Can you select the range(s) that need to be worked on? If so, use a for next loop thus:

    For Each Rnge in Selection

    ' Your code goes here, but replace the cell address with Rnge

    Next Rnge

    When the range(s) is / are selected, this code will perform any given operation on each selected cell in turn.

    HTH

    DominicB

  3. #3
    Angol
    Guest

    re: Second appeal for help-elegant way to do

    Many thanks DominicB for your help. I've just got back to the problem
    and have been reading up on For-Next Loops. Despite much experimenting
    I've still not managed to write what I need.
    I need the macro to execute Application.Run "ATPVBAEN.XLA!Regress",
    ActiveSheet.Range("F2:F251"), ActiveSheet.Range("C2:C251"), False,
    False, , ActiveSheet.Range("AM21"), False, False, False, False, ,
    False.
    and then do the same thing on Ranges F3:F252, C3:C252 and AM41 and so
    on, i.e. to pick data from ranges each of which is one line below its
    predecessor and to print the results to cells 20 lines apart. (What
    happens after that to tidy up the results, produce graphs, etc., works
    fine)
    I need to do this about a thousand times on each set of data.
    While I can see the general idea For-Next-Step 1 and For-Next-Step 20,
    writing what's needed is beyond me.
    Can DominicB or anyone else help?


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1