LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sue Sue is offline
external usenet poster
 
Posts: 285
Default Entering a Sum Formula in VBA with variables

I need to enter a sum formula by code.
I can establish the coordinates of the range in R1C1 form.
Say the points are (subrow1,subcol1) and (subrow2,subcol2).
I can get where I want to put the formula.
I have tried:
ActiveCell.FormulaR1C1="=sum(R[subrow1]C[subcol1]):R[subrow2]C[subcol2])
or ActiveCell.FormulaR1C1="=sum(R[subrow1]C[-1]:R[subrow2]C[-1])
- as the column is adjacent - and variations on the theme but everything
with a variable in it produces a run time error.
I need the total of a variable amount of the column (which is adjacent to
where the total is required.) The formula can not be turned into a fixed
offset but must be a range from the two points. Help!

 
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
Entering Formula - Cannot select cell as it is hidden by formula Jim Excel Worksheet Functions 0 March 25th 10 07:22 AM
Entering a Formula; Remains a Formula Instead of Calculating billbrandi Excel Discussion (Misc queries) 1 April 3rd 08 12:50 AM
entering a formula Moof Excel Worksheet Functions 5 April 26th 07 03:31 AM
Entering variables on Msgbox prompt renegan[_6_] Excel Programming 3 January 4th 06 06:54 PM
entering formula using VBA alex Excel Programming 4 September 16th 03 02:59 PM


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