+ Reply to Thread
Results 1 to 13 of 13

Looking for a way to sum a column with variable length

  1. #1
    Registered User
    Join Date
    05-12-2020
    Location
    USA
    MS-Off Ver
    2010
    Posts
    10

    Looking for a way to sum a column with variable length

    Hi All,

    I am looking for a way to sum a column with variable length. I cannot use (xlUp) because there is other data in cells in this column below the range that I need summed.The range will always start in cell "AA8". So far I have the following code:

    Please Login or Register  to view this content.
    I am not sure how to make this dynamic so that it will sum every cell in column "AA" down to the last cell before the first blank, and then, in that first blank, place the sum of the preceding cells.

    Thank you.
    Last edited by sg1962; 05-12-2020 at 01:09 PM.

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,379

    Re: Looking for a way to sum a column with variable length

    Try this:

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Forum Guru
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    7,746

    Re: Looking for a way to sum a column with variable length

    Welcome to the forum.

    I really am sorry but:-
    I wish I could insert the code tags for you but I cannot.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Please Avoid Joining My List Of Blocked Users by:

    Saying Please and Thank you.

    Making requests not demands.

    Checking back on your post. I will not edit any post after 4 days.

    Marking threads as closed once your issue is resolved. How? The tools at the top

    Any reputation (*) points appreciated. None of us gets paid here.

    If you found someone's input useful, please take a second to click the * at the bottom left to let them know

  4. #4
    Registered User
    Join Date
    05-12-2020
    Location
    USA
    MS-Off Ver
    2010
    Posts
    10

    Re: Looking for a way to sum a column with variable length

    Okay, should be all set. Thank you for letting me know.

  5. #5
    Forum Guru
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    7,746

    Re: Looking for a way to sum a column with variable length

    Please Login or Register  to view this content.

    Some useful code:

    Please Login or Register  to view this content.
    Last edited by mehmetcik; 05-12-2020 at 01:15 PM.

  6. #6
    Registered User
    Join Date
    05-12-2020
    Location
    USA
    MS-Off Ver
    2010
    Posts
    10

    Re: Looking for a way to sum a column with variable length

    I think this is on the right track, but when I run this code, every cell in every column below row 8 is populated with "5045135759.03074." Am I missing something? I am somewhat new to VBA.

  7. #7
    Registered User
    Join Date
    05-12-2020
    Location
    USA
    MS-Off Ver
    2010
    Posts
    10

    Re: Looking for a way to sum a column with variable length

    I think this is on the right track, but when I run this code, every cell in every column below row 8 is populated with "5045135759.03074." Am I missing something? I am somewhat new to VBA

  8. #8
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,379

    Re: Looking for a way to sum a column with variable length

    Did you try the code in post#2? If so:

    Welcome to the forum

    Please attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  9. #9
    Registered User
    Join Date
    05-12-2020
    Location
    USA
    MS-Off Ver
    2010
    Posts
    10

    Re: Looking for a way to sum a column with variable length

    Quote Originally Posted by xladept View Post
    Try this:

    Please Login or Register  to view this content.
    I think this is on the right track, but when I run this code, every cell in every column below row 8 is populated with "5045135759.03074." Am I missing something? I am somewhat new to VBA.

  10. #10
    Registered User
    Join Date
    05-12-2020
    Location
    USA
    MS-Off Ver
    2010
    Posts
    10

    Re: Looking for a way to sum a column with variable length

    Quote Originally Posted by xladept View Post
    Did you try the code in post#2? If so:

    Welcome to the forum

    Please attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Yes I did. It populated every cell with "5045135759.03074"

  11. #11
    Registered User
    Join Date
    05-12-2020
    Location
    USA
    MS-Off Ver
    2010
    Posts
    10

    Re: Looking for a way to sum a column with variable length

    Quote Originally Posted by mehmetcik View Post
    Please Login or Register  to view this content.

    Some useful code:

    Please Login or Register  to view this content.
    SOLVED! Thank you!

  12. #12
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,379

    Re: Looking for a way to sum a column with variable length

    This may work:

    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    05-12-2020
    Location
    USA
    MS-Off Ver
    2010
    Posts
    10

    Re: Looking for a way to sum a column with variable length

    Quote Originally Posted by xladept View Post
    This may work:

    Please Login or Register  to view this content.
    Thank you!

+ 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] Unlocking numerous check boxes in a single column, variable column length
    By PeteSpec in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-12-2019, 03:54 PM
  2. How to fill a column with data if the column has a variable length?
    By flyingdutch06 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-16-2016, 09:02 AM
  3. Replies: 6
    Last Post: 04-14-2012, 04:07 AM
  4. Last Cell in a Variable Length Column
    By akj375 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-11-2011, 10:25 PM
  5. Autosum a variable column length using VB
    By sid in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-17-2006, 11:10 AM
  6. Sum a Column of Variable length
    By Chris G in forum Excel General
    Replies: 4
    Last Post: 11-07-2005, 08:30 AM
  7. Sum a column of variable length?
    By Brian in forum Excel General
    Replies: 5
    Last Post: 02-03-2005, 11:06 AM

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