Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default Sum Forula using variables

You are welcome! Thanks for the feedback!
Stefi

Sue ezt *rta:

Thanks, that solves my problem. I did try many & and " but when I had some
right I always had something wrong. Thanks so much.

"Stefi" wrote:

ActiveCell.Formula = "=Sum(" & LowerAddress & ":" & UpperAddress & ")"

Regards,
Stefi

Sue ezt *rta:

I have a position where I want a total. I have cells (Lower and Upper) that I
want to sum between. I have checked the addresses of these range variables
and they are correct (and the data between them is numeric). But I can not
seem to get it right in the "sum" formula. I have tried using using the range
variables, the address (string) variables, I have put quotes all over the
place - Help!!

'Record position for subtotal
Set SubPos = ActiveCell
SubPosAddress = SubPos.Address

'Coordinates of lower cell in total
Set LowerCell = ActiveCell.Offset(0, -1)
LowerAddress = LowerCell.Address

ActiveCell.End(xlUp).Select

'Coordinates of upper cell in total
Set UpperCell = ActiveCell.Offset(1, -1)
UpperAddress = UpperCell.Address

'Return to marked position
SubPos.Select

** ActiveCell.Formula = "=Sum(Lowercell : Uppercell)"
This line is rubbish but it is the idea I want.

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
forula needed ez3zz Excel Worksheet Functions 0 February 10th 09 04:31 PM
Not at all clear on use of variables and/or object variables JMay-Rke Excel Discussion (Misc queries) 11 July 4th 08 06:36 PM
Storing variables in a macro and using those variables to performcalculations. [email protected] Excel Programming 3 December 10th 07 04:13 PM
simple forula cbazoo Excel Discussion (Misc queries) 2 October 4th 07 07:34 PM
Too Many Variables Heliocracy Excel Worksheet Functions 6 April 6th 07 07:02 PM


All times are GMT +1. The time now is 10:05 PM.

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

About Us

"It's about Microsoft Excel"