Results 1 to 4 of 4

loop for shifting one column after each calculation

Threaded View

burnmeister loop for shifting one column... 04-02-2013, 03:40 AM
Wormsek Re: loop for shifting one... 04-02-2013, 04:00 AM
burnmeister Re: loop for shifting one... 04-02-2013, 06:50 AM
Wormsek Re: loop for shifting one... 04-02-2013, 03:53 PM
  1. #1
    Registered User
    Join Date
    04-01-2013
    Location
    Malelane, South Africa
    MS-Off Ver
    Excel 2010
    Posts
    6

    loop for shifting one column after each calculation

    Good day

    I have a dataset arranged in columns. I need to calculate the slope that exists between the data of two columns, and repeat it for subsequent columns. However, the array of y-values remain the same with each calculation, but the array of x values moves 1 column forward after each calculation.

    My sub for the first two calculations looks something like this:

    Sub slopes()
    '
    ' slopes Macro
    '
    
    '
        ActiveCell.FormulaR1C1 = "=SLOPE(R[-50]C[-1]:R[-3]C[-1],R[-50]C:R[-3]C)"
        Range("C51").Select
        
        ActiveCell.FormulaR1C1 = "=SLOPE(R[-50]C[-2]:R[-3]C[-2],R[-50]C:R[-3]C)"
        Range("D51").Select
    End Sub
    How do I create a loop to automatically repeat this process till the last column? I have attached the excel worksheet if that helps...
    Sorry if this is an elementary question - I am still new in the VBA world...

    Regards
    Brand
    Attached Files Attached Files
    Last edited by arlu1201; 04-02-2013 at 03:48 AM. Reason: Use code tags in future.

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