![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Mar 2002
Posts: 2
|
I want to insert a formula dynamically into a cell in an excel sheet. I am using the following line of code
ActiveCell.FormulaR1C1 = "=Subtotal(2, D2:A" & FinalRow & ")" However in the excel sheet it includes qoutes like this =SUBTOTAL(2, 'D2':'A256') Does anyone now how to insert a formula like this correctly Regards padraigmc |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
First off, what is the range that you want to include in the subtotal?
Secondly, if you want to use R1C1 notation then cell D2 has to be entered as R2C4 Hope this helps. Kind regards, Al. |
|
|
|
|
|
#3 |
|
Legend
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
|
The R1C1 methodology is inserting the quotes. Try this:
ActiveCell = "=Subtotal(2, D2:A" & FinalRow & ")" Hope this helps. _________________ Cheers, NateO [ This Message was edited by: NateO on 2002-03-18 11:27 ] |
|
|
|
|
|
#4 | |
|
Board Regular
Join Date: Feb 2002
Location: Tulsa, OK
Posts: 354
|
Quote:
I use ?? because I want to determins the ?? using Range("B65536").End(xlUp).Address or something akin to that? How do I get this work for any kind of formula? |
|
|
|
|
|
|
#5 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
To make it simpler you can place the following formula in a different column:
=max(b:b) It will find the max in the entire column B.
__________________
Kind regards, Al Chara |
|
|
|
|
|
#6 |
|
Board Regular
Join Date: Feb 2002
Location: Tulsa, OK
Posts: 354
|
I have to many columns to do use MAX(B:B)
I changed the formula to this, ActiveCell = "=MAX(D2:D" & FinalRow & ")" but it puts =MAX(D2:D) in the row underneath the final row of the list. What does "& FinalRow &" do? Do I need to define it first? |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|