Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
forula needed | Excel Worksheet Functions | |||
Not at all clear on use of variables and/or object variables | Excel Discussion (Misc queries) | |||
Storing variables in a macro and using those variables to performcalculations. | Excel Programming | |||
simple forula | Excel Discussion (Misc queries) | |||
Too Many Variables | Excel Worksheet Functions |