Here's my code:
What I was hoping to get initially was a solution which could
be applied to ANY column - dynamically, something which I began
to specify in subsequent posts.
And something which, if not elegantly or efficiently, my code does.
Yours requires, your words, a modification of the code to apply
to a different column.
In the attached spreadsheet, I can pick drop down data from ANY
column, then click on the uppermost cell of the data, run my macro
and get a total of said data.
Your macro only works on column B, unless I modify the code.
Your macro does not require selection or a range name, but ONLY
works on one column, unless it is modified.
As I previously explained, and further elaborate on, the user I am
providing this code for, is not macro or vba literate, and in dealing
with MANY columns of multiple data sets, to modify the code for
each column is more work than I could or they would reasonably
expect - that would be equally inefficient - no?
I think this could prove to be useful for users in similar situations.
My code or your code, doesn't matter to me, but, it should,
for my purposes be able to:
1) Determine the total of ANY column
2) Not require the code to be modified from column to column
and
most efficiently
3) Not require selection or range name
First and foremost steps 1 and 2
My code does 1 and 2
Your code gives the total of a specific column, requires modification of
the code for any other column, but does not require selection of
cells or the naming of a range.
My code determines the total of any column, does not require
modification of the code for any other column, but DOES require
selection of cells and the naming of a range.
To reconcile your conditions with my request would mean your code
does what mine does without the selection of cells or the naming of
a range.
Doesn't mean my code is better than yours, means my code does
what I'd like it to do, but not as efficiently as your code, or as you
would like, or think it ought to.
Agreed?
Best of all worlds would be to be able to be prompted for any
column, or range, or named range, and have a total returned
based on your method.
Better yet, it could then either prompt the user for a location
in which to store the data in, perhaps a format such as:
Cell1---Cell 2
Item:--Total
or automatically store the results in a specific coded location(s)
same or different worksheet/workbook.
That may be getting well ahead of the game. For now, just
the return of a total from ANY column is probably enough.
(Spreadsheet attached
with yours and my code)
Bookmarks