dynamic autofill issue

excel_2009

Active Member
Joined
Sep 14, 2009
Messages
318
hi excel gurus, i am having difficulty and was wondeirng if someone can help

i have the following table

A | B | C
1 3
3 3
4 1
5 5

and i wish for column C to contain the formula of A2+B2, however i want it assigned to a macro/vba coding so that when the button is pressed the formula is dragged down, however the number of rows from A/B will vary on a daily basis

can someone help :)??
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Try

Code:
Sub test()
Dim LR As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
Range("C2:C" & LR).Formula = "=A2+B2"
End Sub
 
Upvote 0
Code:
[COLOR="Blue"]Sub[/COLOR] SetFormula()
    Range("C2:C" & Range("A1").End(xlDown).Row).FormulaR1C1 = "=RC[-2]+RC[-1]"
[COLOR="Blue"]End[/COLOR] [COLOR="Blue"]Sub[/COLOR]
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,292
Members
452,902
Latest member
Knuddeluff

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