+ Reply to Thread
Results 1 to 4 of 4

Repeat macro starting 5 columns across

  1. #1
    Registered User
    Join Date
    07-23-2014
    Location
    Manchester, England
    MS-Off Ver
    2013
    Posts
    8

    Repeat macro starting 5 columns across

    Hi Everyone,

    I have a macro which several users kindly helped me with yesterday. The code now does exactly what I want it to but I now need the macro to perform exactly the same process starting again at column G (i.e. 5 columns on from the start of the macro written down below) with the answers underneath those columns. I'd then like it to repeat the macro another 5 columns further on etc etc. I think I'm close to solving it but can't quite get there. Any help would be most appreciated.

    10000 limit macro.PNG

  2. #2
    Valued Forum Contributor
    Join Date
    01-19-2012
    Location
    Barrington, IL
    MS-Off Ver
    Excel 2007/2010
    Posts
    1,211

    Re: Repeat macro starting 5 columns across

    Pasting the code itself instead of the screenshot of the code would be much more useful, so people don't have to type in all of your code to test and help you out.

    please paste the code and put
    Please Login or Register  to view this content.
    tags around it
    You should hit F5, because chances are I've edited this post at least 5 times.
    Example of Array Formulas
    Quote Originally Posted by Jacc View Post
    Sorry, your description makes no sense. I just made some formula that looks interesting cause I had nothing else to do.
    Click the * below on any post that helped you.

  3. #3
    Registered User
    Join Date
    07-23-2014
    Location
    Manchester, England
    MS-Off Ver
    2013
    Posts
    8

    Re: Repeat macro starting 5 columns across

    [HTML]Sub DLANetPaySplit()
    '
    ' DLANetPaySplit Macro
    ' Splits Net pay at the £10,000 DLA threshold
    '
    Dim i, lastrow As Long

    lastrow = Range("B" & Rows.Count).End(xlUp).Row
    btotal = 0
    ctotal = 0
    dtotal = 0
    etotal = 0
    For i = 4 To lastrow 'change the 1 to whatever the first row of numbers is to include headers.
    If btotal + Cells(i, 2).Value <= 10000 Then
    btotal = btotal + Cells(i, 2).Value
    ctotal = ctotal + Cells(i, 3).Value
    dtotal = dtotal + Cells(i, 4).Value
    etotal = etotal + Cells(i, 5).Value
    Else: GoTo limited
    End If
    Next i
    limited:
    Cells(lastrow + 2, 2).Value = btotal
    Cells(lastrow + 2, 3).Value = ctotal
    Cells(lastrow + 2, 4).Value = dtotal
    Cells(lastrow + 2, 5).Value = etotal
    '
    End Sub[HTML]

  4. #4
    Registered User
    Join Date
    07-23-2014
    Location
    Manchester, England
    MS-Off Ver
    2013
    Posts
    8

    Re: Repeat macro starting 5 columns across

    Sorry about that. Code above

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Delete Columns in Multiple Sheets with repeat macro
    By candie025 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-17-2014, 03:01 AM
  2. Repeat the existing macro for starting at different cell.
    By aadeshgandhi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-04-2013, 02:26 PM
  3. [SOLVED] Macro to convert 4 columns of data into rows, then repeat
    By liastar in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-22-2012, 03:52 AM
  4. Macro to repeat autofil in several columns
    By DKerr in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-18-2010, 09:41 AM
  5. Replies: 2
    Last Post: 08-24-2005, 12:05 PM

Tags for this Thread

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