Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Sum Cells and assign to variable

I have a cell that needs to show the result of a formula.

Both the numerator and denominator are made up of a series
of contiguous cells that are not subtotaled in their
worksheets. I do not need the numerator and denominator
values; just the result.

In my VBA code, I tried setting variable Numerator=Sum
("K6:K12"), and I received an error that variable Sum
wasn't defined. I know I can add each element to
Numerator separately, but would prefer not to, if that's
possible.

Thanks for any suggestions.

Kitty

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Sum Cells and assign to variable

One way:

Numerator = Application.WorksheetFunction.Sum(Range("K6:K12"))

In article ,
"Kitty" wrote:

I have a cell that needs to show the result of a formula.

Both the numerator and denominator are made up of a series
of contiguous cells that are not subtotaled in their
worksheets. I do not need the numerator and denominator
values; just the result.

In my VBA code, I tried setting variable Numerator=Sum
("K6:K12"), and I received an error that variable Sum
wasn't defined. I know I can add each element to
Numerator separately, but would prefer not to, if that's
possible.

Thanks for any suggestions.

Kitty

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Sum Cells and assign to variable

Perfect! Thank you so much for your help.

Kitty


-----Original Message-----
One way:

Numerator = Application.WorksheetFunction.Sum(Range

("K6:K12"))

In article ,
"Kitty" wrote:

I have a cell that needs to show the result of a

formula.

Both the numerator and denominator are made up of a

series
of contiguous cells that are not subtotaled in their
worksheets. I do not need the numerator and

denominator
values; just the result.

In my VBA code, I tried setting variable Numerator=Sum
("K6:K12"), and I received an error that variable Sum
wasn't defined. I know I can add each element to
Numerator separately, but would prefer not to, if

that's
possible.

Thanks for any suggestions.

Kitty

.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Assign value to a variable name Gnarlodious Excel Discussion (Misc queries) 2 August 20th 06 07:10 AM
Assign value to variable rroach Excel Discussion (Misc queries) 1 July 13th 05 05:24 AM
Variable VB to assign new sheet name Kevin M Excel Worksheet Functions 0 June 17th 05 12:15 AM
VBA routine to assign first name only to a variable fitful_thought Excel Programming 6 August 3rd 04 01:39 PM
Assign Formula to Variable James Stephens Excel Programming 3 February 26th 04 04:16 PM


All times are GMT +1. The time now is 05:23 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"