Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Refreshing formulas via VBA


This is my first post to this forum so apologies if this is one of thos
questions that get asked 100s of times.

I am using VBA to ask user various questions which results in th
automatic generation of product quotation (costs, discounts etc).

largely it is working fine but I am having trouble calculating totals.

I use a template sheet which is copied I then INSERTROWs into the cop
based on the users responses.

In the template I have various rows detailing sub-totals / totals.

As rows are inserted the SUM function does not necessaril
automatically update itself. i.e. the SUM may start life as SUM (E1
(an arbitrary blank cell). After I have inserted X number of rows
expected the SUM function to refresh itself to say SUM(E1:E10).

Is there a better way of doing this - Am I expecting too much

--
longy
-----------------------------------------------------------------------
longyp's Profile: http://www.excelforum.com/member.php...fo&userid=3104
View this thread: http://www.excelforum.com/showthread.php?threadid=50716

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Refreshing formulas via VBA

I like to put my sum/subtotals in row 1. Then I can use:

=sum(a3:A65536)
and not have to worry about where I inserted rows or adjusting the formula.

But if you're formula is at the bottom, you could use a formula like this:

This formula is in A25 and sums A3:A24:
=sum(A3:offset(a25,-1,0))



longyp wrote:

This is my first post to this forum so apologies if this is one of those
questions that get asked 100s of times.

I am using VBA to ask user various questions which results in the
automatic generation of product quotation (costs, discounts etc).

largely it is working fine but I am having trouble calculating totals.

I use a template sheet which is copied I then INSERTROWs into the copy
based on the users responses.

In the template I have various rows detailing sub-totals / totals.

As rows are inserted the SUM function does not necessarily
automatically update itself. i.e. the SUM may start life as SUM (E1)
(an arbitrary blank cell). After I have inserted X number of rows I
expected the SUM function to refresh itself to say SUM(E1:E10).

Is there a better way of doing this - Am I expecting too much?

--
longyp
------------------------------------------------------------------------
longyp's Profile: http://www.excelforum.com/member.php...o&userid=31044
View this thread: http://www.excelforum.com/showthread...hreadid=507169


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 137
Default Refreshing formulas via VBA

Hi Longyp,

No need for VBA ...
Why don't you just name the first cell E1 and your current last cell
(with Insert Name Define ) with names such as 'Start' and 'End' , and
have your sum formula look like : sum(Start:End)
From then, all rows inserted in between will be included in your total

....
HTH
Cheers
Carim

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Refreshing formulas via VBA


Thanks People.

I like the naming idea start:end.


--
longyp
------------------------------------------------------------------------
longyp's Profile: http://www.excelforum.com/member.php...o&userid=31044
View this thread: http://www.excelforum.com/showthread...hreadid=507169

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
Refreshing formulas automatically Gingerly Excel Discussion (Misc queries) 3 September 30th 09 08:28 PM
Drop Formulas when refreshing data from external source Indy-Joe Excel Discussion (Misc queries) 1 September 25th 07 01:38 AM
NOW() and SECOND() not refreshing tgmjf Excel Worksheet Functions 2 July 18th 06 10:56 PM
refreshing formulas in cells He4Giv Excel Discussion (Misc queries) 10 November 28th 05 05:01 PM
refreshing formulas in cells He4Giv Excel Discussion (Misc queries) 0 December 18th 04 10:11 AM


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