Dynamic formula help

ricklorion

New Member
Joined
Jun 8, 2009
Messages
3
Hello,

I am trying to create a macro where formulas are dynamically inserted into cells. I get this error when I try to use this macro "Expected: end of statement".

I currently have:

Code:
intFormula = r + 6
Range("J" & intFormula).Select
    With Selection
        .formula = "=average(J8:J" & footer ")"
    End With

This is what I enter manually:
J21:
Code:
=AVERAGE(J8:J20)
J22:
Code:
=MIN(J8:J20)
J23:
Code:
=MAX(J8:J20)
J24:
Code:
=J23-J22

Please help. :confused:
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
You're missing an "&"


.formula = "=average(J8:J" & footer & ")"
</pre>
 
Upvote 0
What are the values of 'footer' and 'uniform'?

They'd have to be integers for this to work.
 
Upvote 0

Forum statistics

Threads
1,214,908
Messages
6,122,187
Members
449,071
Latest member
cdnMech

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