Changing the formula in a number of cells

lfeeder

New Member
Joined
Mar 10, 2013
Messages
1
I've created a user form to enter some values in a few adjacent cells. When the user clicks on a button, I want several other cells to be loaded with special formulas that refer to the new values. This happens on a row by row basis. First, a working formula in that cell which is AB5 is:
Code:
 =IFERROR((IF(AK5<0.2,((((AK5*100)-2)/10)*(AJ5/60)),(((AK5*100)-2)/7)*(AJ5/60))),0)
Now, here's my code for the that first cell:
Code:
Private Sub btnSave_Click()
 TheRow = ActiveCell.Row
 TheCol = ActiveCell.Column
        Cells(TheRow, 28).Select      ' I want to work with Column AB for whatever row is the active row      
        Selection.FormulaR1C1 = "=IFERROR((IF(RC[9]<0.2,((((RC[9]*100)-2)/10)*(RC[8]/60)),(((RC[9]*100-2)/7)*(RC[8]/60))),0)"
End Sub
I'll have a few other formulas to store into other nearby cells, but if I know how to do this one, I'll be able to figure out how to do the others. TIA, Leon
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Range("g3").Copy
Range("g4:g100", Range("g3").End(xlDown).Offset(, 0))

Application.Calculation
= xlCalculationAutomatic

Change the offset if
you need it copied to the next column etc and modify how you want.
 
Upvote 0

Forum statistics

Threads
1,215,388
Messages
6,124,652
Members
449,177
Latest member
Sousanna Aristiadou

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