View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Getting the Sum Total of a variable Range

"Close to flaming"? Are you kidding? First off, the ORIGINAL question asked
for a User Defined Function (UDF)... note the word "function"... Jacob
posted a macro, which is not a function, it is a subroutine... UDF's work
automatically, macros need to be called individually. Second, the sample
workbook the OP posted showed a worksheet that had three sets of ranges that
needed to be summed up... Jacob's macro, as written, will not work on that
worksheet. Third, Jacob's macro does not "hold the sum" in a variable as the
OP later asked me; so, for the last two reasons, I'm not completely sure
Jacob's solution "works" in the way the OP wanted. Fourth, as for knowing
where to place the formula... I figured since the OP asked for a UDF, the
formula was to be placed "by eye" and, as data was added (assuming data
would be added), the formula could be moved easily enough (click/drag the
cell's border) to the new location. Truthfully, in total, I was confused as
to what the OP actually wants (maybe needs is a better word), so I asked.
Why do you consider that "close to flaming"?

--
Rick (MVP - Excel)


"littleredhairedgirl" wrote in message
...
Good discussion. To close to flaming.
Seems pretty clear. Jacob's solution works. Rick's not so much. If you
didn't know where the last cell was, how could you put a formula in
it.




On Apr 19, 12:11 pm, "Rick Rothstein"
wrote:
I'm not sure what you mean... a UDF is a function that returns a value and
then closes down... can you explain in more detail what you are trying to
do
and why you think you need to "hold the sum" in a variable? I would also
ask
you... are you definitely looking for a UDF (as you asked for in your
initial post) or are you looking for a macro (you mentioned "macro" in
your
response to gmorris)? Perhaps if you tell us exactly what you are trying
to
do, what you need will become clearer.

--
Rick (MVP - Excel)

"wutzke" wrote in message

...



can I create a variable in the UDF that holds the sum?