VBA code that will reapply my formula to the specific range of cells

glenn0004

New Member
Joined
Nov 15, 2011
Messages
18
Hi All

I have an ongoing requirement that I'm trying to resolve within a sales order workbook. If Sales person has agreed a fixed price for subsequent sales order lines they enter the price in to sheet 1, and the pricing is pulled through to each order line on sheet 2. However if the Sales person has not agreed a fixed price for subsequent sales order line they manually enter the price in to the second sheet and overwrite the formula that was originally pulling through the price.

My problem is now that the formula is overwritten and the workbook is now erroneous if reused to create another order as some order lines will contain the will contain the formula and some will not. Is there a VBA code that will reapply my formula to the specific range of cells that the user can run.

Many thanks in advance.
 
Hi Mike,

That would work perfectly. I think I offered my version because I didn't think very hard about it and, perhaps, it is easier to read.

Regards
 
Upvote 0

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Thanks for this, however there a few if's and buts to accommodate my vast usergroup.

However in trying to accommodate my vast usergroup, it's been suggested to try and auto fill the required formula as opposed to reset a formula to a range of cells. At the moment i have the below which works on one column, but need to adapt the code to run different formula over different columns. any idea?

Code:
Sub FillFormula()
Range("T32").Formula = "=Contract!$C$61"
Range("T32", "T" & Cells(Rows.Count, 1).End(xlUp).Row).FillDown
End Sub


Thanks in advance
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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