Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help with formulas (Sum)

Hi,
I wanted to insert some rows in the Excel sheet on a button clic
dynamically, and I wanted the sum of all cells of that row to b
displayed on the last cell. I tried this using Sum(B5:I5) and it work
fine for this. But, I want the same functioniality to be inserte
dynamically based on the number of row that is selected, in such a wa
the row number can be changed from 5 to 6 and so on.
I tried using:
sum((Chr(Asc("A") + 1) & iCounter + 1) : (Chr(Asc("A") + 5) & iCounte
+ 1)). But, this is not working.

I hope that I have made my problem clear enough. Can anyone suggest th
solution to this problem.

Thanks,
Samee

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Help with formulas (Sum)

Hi
why not insert the formula like
cell_object.FormulaR1C1="=SUM(R[0]C2:R[0]C9)"

--
Regards
Frank Kabel
Frankfurt, Germany


Hi,
I wanted to insert some rows in the Excel sheet on a button click
dynamically, and I wanted the sum of all cells of that row to be
displayed on the last cell. I tried this using Sum(B5:I5) and it

works
fine for this. But, I want the same functioniality to be inserted
dynamically based on the number of row that is selected, in such a

way
the row number can be changed from 5 to 6 and so on.
I tried using:
sum((Chr(Asc("A") + 1) & iCounter + 1) : (Chr(Asc("A") + 5) &

iCounter
+ 1)). But, this is not working.

I hope that I have made my problem clear enough. Can anyone suggest
the solution to this problem.

Thanks,
Sameer


---
Message posted from http://www.ExcelForum.com/


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Help with formulas (Sum)

Hi Sameer,

This does it

Rows("10:15").EntireRow.Insert
Range("J10:J15").Formula = "=SUM(B5:I5)"

but the sum is always 0 at this point as there is no data to sum, and it is
not dynamic, that is always 10:15. it can be dynamic with

Dim StartRow As Long

StartRow = 7
Rows(StartRow & ":" & StartRow + 5).EntireRow.Insert
Range("J" & StartRow & ":J" & StartRow + 5).Formula = _
"=SUM(B" & StartRow & ":I" & StartRow & ")"

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"sameerce " wrote in message
...
Hi,
I wanted to insert some rows in the Excel sheet on a button click
dynamically, and I wanted the sum of all cells of that row to be
displayed on the last cell. I tried this using Sum(B5:I5) and it works
fine for this. But, I want the same functioniality to be inserted
dynamically based on the number of row that is selected, in such a way
the row number can be changed from 5 to 6 and so on.
I tried using:
sum((Chr(Asc("A") + 1) & iCounter + 1) : (Chr(Asc("A") + 5) & iCounter
+ 1)). But, this is not working.

I hope that I have made my problem clear enough. Can anyone suggest the
solution to this problem.

Thanks,
Sameer


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help with formulas (Sum)

The code send by you works fine. Thanks a lot.
Samee

--
Message posted from http://www.ExcelForum.com

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
Convert Array Formulas to Regular Formulas Domenick Excel Worksheet Functions 6 August 17th 15 09:16 PM
E2007 formulas display as formulas, not results Pierre Excel Worksheet Functions 3 January 14th 10 04:59 PM
Counting # of Formulas in a column with formulas and entered data Brand Excel Worksheet Functions 1 October 10th 09 01:01 PM
CELLS NOT CALC FORMULAS - VALUES STAY SME FORMULAS CORRECT?? HELP Sherberg Excel Worksheet Functions 4 September 11th 07 01:34 AM
Formulas not evaluated, Formulas treated as strings Bob Sullentrup Excel Discussion (Misc queries) 0 November 27th 06 08:01 PM


All times are GMT +1. The time now is 07:33 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"