+ Reply to Thread
Results 1 to 5 of 5

A Macro to sum up colums data monthly.?

  1. #1
    Registered User
    Join Date
    10-05-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    42

    Question A Macro to sum up colums data monthly.?

    good day!

    I just want a little help on how to automate a macro that will add a value from first column to second column and display the total on second column itself and soon. I need to create a macro code because I have 700 cells and 12 rows to automate.File sample attached.
    Something like this:
    Please Login or Register  to view this content.
    thank you!
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    01-14-2004
    Posts
    6

    Re: A Macro to sum up colums data monthly.?

    Hopefully this is what you need...
    Please Login or Register  to view this content.
    Last edited by arlu1201; 03-27-2012 at 06:40 AM.

  3. #3
    Registered User
    Join Date
    10-05-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    42

    Re: A Macro to sum up colums data monthly.?

    Quote Originally Posted by gazzabj View Post
    Hopefully this is what you need...

    Public Sub AddCols()
    Dim colcounter As Integer
    Dim rowcounter As Long

    For rowcounter = 2 To 700
    For colcounter = 2 To 12
    Cells(rowcounter, colcounter).Value = Cells(rowcounter, colcounter).Value + Cells(rowcounter, colcounter - 1).Value
    Next
    Next


    End Sub
    Thank you gazzabj.

    I've modified the code to something like below but I got this error "Runtype Error "13" Type Mismatch.

    Please Login or Register  to view this content.
    Actual data attached!

    Thank you!
    Attached Files Attached Files
    Last edited by adbasanta; 03-26-2012 at 10:45 PM.

  4. #4
    Registered User
    Join Date
    01-14-2004
    Posts
    6

    Re: A Macro to sum up colums data monthly.?

    Quote Originally Posted by adbasanta View Post
    Thank you gazzabj.

    I've modified the code to something like below but I got this error "Runtype Error "13" Type Mismatch.

    Please Login or Register  to view this content.
    Actual data attached!

    Thank you!
    Your referencing sheet21 when it should be 1?
    Other than that the code works fine when I test it.

    Gazza

  5. #5
    Registered User
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,157

    Re: A Macro to sum up colums data monthly.?

    Gazzabj,

    Welcome to the forum. Please put code tags for any code that you use in future. I have done it for you this time.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ 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