Entering Formulas

Hannah

Board Regular
Joined
Aug 20, 2002
Messages
51
Just wondering what the format is for entering formulas using vb....

I want to enter them into a row that i've just inserted, and i want them to sum all the values above until they reach another row that also holds totals, the cells in these rows will be in another colour...for arguements sake we'll say red.

Eg....

aaaa 1 2 3 4 5
aaaa 6 7 8 9 10
Totals for aaaa in red
bbbb 1 2 3 4 5
bbbb 6 7 8 9 10
bbbb 5 6 7 8 3
Totals for bbbb in red

etc etc

Any ideas????
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
My approach would be to use Data | Subtotals. Then, if you need to, you can change the subtotals formatting to show them in red. You can record a macro while you do this to get the appropiate syntax.
 
Upvote 0
Thanks but it's not quite what I'm looking for...this has to be fully automated for the user. i'm mainly after the syntax for entering the formula in the active row, after that I'm probably alright.

Any other suggestions?
 
Upvote 0
Using Data | Subtotals, can also be fully automated, but, anyway... to insert a formula in the activecell you use

ActiveCell.Formula = "=SUM(A1:A3)"
 
Upvote 0

Forum statistics

Threads
1,203,487
Messages
6,055,713
Members
444,810
Latest member
ExcelMuch

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top