Results 1 to 4 of 4

Adding up values and grand totals through vba

Threaded View

  1. #1
    Forum Contributor
    Join Date
    02-12-2011
    Location
    Hyderabad
    MS-Off Ver
    Excel 2016
    Posts
    270

    Adding up values and grand totals through vba

    Hi All

    I am generating certain number for a table. I am trying to write a vba code for numbers to be added row wise and column wise.
    I am unable to move the second row to add the values in column "O". Below is the code, can u tell me how to move to the next row
    so that sum is generated .

    Private Sub Command Button1_Click()
    Dim ab1 As Range
    Dim AB2 As Range
    Dim ab3 As Long
    Dim ab4 As Long
    Dim AB5 As Long
    Dim AB6 As Range
    
    'Random numbers
    For Each ab1 In Range("c2:n27")
    ab1.Offset(0, 0).Value = Application.WorksheetFunction.RandBetween(325, 956)
    Next ab1
    
    'Adding Values
    For Each AB2 In Range("o2:o27")
    AB2.Offset(0, 0).Value = Application.WorksheetFunction.Sum(Range("C2: N2"))    'From this point how will i move to the next row c3:n3 ???
    Next AB2
    End Sub
    Many thanx in advance
    Attached Files Attached Files
    Never confuse a single defeat to the final defeat.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Grand Totals to top of page
    By Cburrows in forum Excel General
    Replies: 4
    Last Post: 03-08-2012, 01:58 PM
  2. Method for calculating Invoice Totals and Grand totals
    By sahran4441 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-06-2010, 10:24 PM
  3. Replies: 4
    Last Post: 01-10-2008, 12:31 PM
  4. [SOLVED] Can't get Grand Totals (rows) to appear
    By TonyG in forum Excel General
    Replies: 1
    Last Post: 05-23-2006, 10:06 PM
  5. Pivottable:adding grand totals
    By arthursdomain@gmail.com in forum Excel General
    Replies: 3
    Last Post: 12-06-2005, 06:10 PM

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