Results 1 to 18 of 18

Adding numbers from an array into a single cell

Threaded View

  1. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Adding numbers from an array into a single cell

    Try
    Sub test()
        Dim myAreas As Areas, i As Long, ii As Long, a()
        With Sheets("sheet1")
            Set myAreas = .Columns("g").SpecialCells(-4123, 1).Areas
            ReDim a(1 To 1)
            For i = 2 To myAreas.Count Step 2
                If myAreas(i).Rows.Count = 1 Then
                    If UBound(a) < myAreas(i).CurrentRegion.Columns.Count Then
                        ReDim a(1 To myAreas(i).CurrentRegion.Columns.Count)
                    End If
                    For ii = 1 To myAreas(i).CurrentRegion.Columns.Count
                        a(ii) = a(ii) + myAreas(i)(1, ii).Value
                    Next
                End If
            Next
            .[g40].Resize(, UBound(a)).Value = a
        End With
    End Sub
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 11
    Last Post: 10-16-2013, 10:21 PM
  2. Adding multiple numbers within a single cell
    By Jmac1961 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-29-2013, 02:19 PM
  3. [SOLVED] Adding 2 numbers from a single cell
    By tom hatten in forum Excel General
    Replies: 2
    Last Post: 08-18-2012, 09:24 AM
  4. adding numbers in a single cell
    By mmurrhee in forum Excel General
    Replies: 10
    Last Post: 03-31-2009, 03:39 PM
  5. adding numbers in a single cell as a running total in that cell ?
    By jlg371 in forum Excel - New Users/Basics
    Replies: 9
    Last Post: 02-01-2009, 08:40 PM
  6. Adding numbers from a single cell
    By hri1428 in forum Excel General
    Replies: 7
    Last Post: 09-18-2008, 06:48 PM
  7. Adding 5 numbers to a single 3 digit
    By wd8ekd in forum Excel - New Users/Basics
    Replies: 8
    Last Post: 07-26-2008, 01:49 PM
  8. Adding numbers in a single cell
    By chefcasey in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-14-2005, 02:05 AM

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