Simplified Code

K

Keith

My macro skills are mediocre at best so can anyone help me simplify
this code? Any help would be appreciated. Thanks.

Private Sub OptionButton2_Click()
Application.ScreenUpdating = False
Sheets("READY MIX - LF").Select
Sheets("READY MIX - LF").Range("C13").Select
ActiveCell.FormulaR1C1 = _
"='READY MIX'!RC+('READY MIX'!RC*(1-(LF!R23C3/100)))*(LF!
R17C3)/100"
Sheets("READY MIX - LF").Range("C14").Select
ActiveCell.FormulaR1C1 = _
"='READY MIX'!RC+('READY MIX'!RC*(1-(LF!R23C3/100)))*(LF!
R17C3)/100"
Sheets("READY MIX - LF").Range("C15").Select
ActiveCell.FormulaR1C1 = _
"='READY MIX'!RC+('READY MIX'!RC*(1-(LF!R23C3/100)))*(LF!
R17C3)/100"
Sheets("READY MIX - LF").Range("C16").Select
ActiveCell.FormulaR1C1 = _
"='READY MIX'!RC+('READY MIX'!RC*(1-(LF!R23C3/100)))*(LF!
R17C3)/100"
Sheets("READY MIX - LF").Range("C17").Select
ActiveCell.FormulaR1C1 = _
"='READY MIX'!RC+('READY MIX'!RC*(1-(LF!R23C3/100)))*(LF!
R17C3)/100"
Sheets("READY MIX - LF").Range("F13").Select
ActiveCell.FormulaR1C1 = _
"='READY MIX'!RC+('READY MIX'!RC*(1-(LF!
R23C3/100)))*(LF!R17C3)/100"
Sheets("READY MIX - LF").Range("F14").Select
ActiveCell.FormulaR1C1 = _
"='READY MIX'!RC+('READY MIX'!RC*(1-(LF!
R23C3/100)))*(LF!R17C3)/100"
Sheets("READY MIX - LF").Range("F15").Select
ActiveCell.FormulaR1C1 = _
"='READY MIX'!RC+('READY MIX'!RC*(1-(LF!
R23C3/100)))*(LF!R17C3)/100"
Sheets("READY MIX - LF").Range("F16").Select
ActiveCell.FormulaR1C1 = _
"='READY MIX'!RC+('READY MIX'!RC*(1-(LF!
R23C3/100)))*(LF!R17C3)/100"
Sheets("READY MIX - LF").Range("F17").Select
ActiveCell.FormulaR1C1 = _
"='READY MIX'!RC+('READY MIX'!RC*(1-(LF!
R23C3/100)))*(LF!R17C3)/100"

End Sub
 
N

NOPIK

Private Sub OptionButton2_Click()
Union(Sheets("READY MIX - LF").Range("C13:C17"), Sheets("READY MIX -
LF").Range("F13:F17")).FormulaR1C1 = _
"='READY MIX'!RC+('READY MIX'!RC*(1-(LF!R23C3/100)))*(LF!
R17C3)/100"
End Sub
 
K

Keith

Private Sub OptionButton2_Click()
 Union(Sheets("READY MIX - LF").Range("C13:C17"), Sheets("READY MIX -
LF").Range("F13:F17")).FormulaR1C1 = _
        "='READY MIX'!RC+('READY MIX'!RC*(1-(LF!R23C3/100)))*(LF!
R17C3)/100"
End Sub

Thanks for the reply. I'm getting a syntax error when i try and run
it. Any thoughts?
 
G

Gary Keramidas

i think you're getting a syntax error because of this:
READY MIX - LF
make sure occurrences both have spaces before and after the "-"

--


Gary


Private Sub OptionButton2_Click()
Union(Sheets("READY MIX - LF").Range("C13:C17"), Sheets("READY MIX -
LF").Range("F13:F17")).FormulaR1C1 = _
"='READY MIX'!RC+('READY MIX'!RC*(1-(LF!R23C3/100)))*(LF!
R17C3)/100"
End Sub

Thanks for the reply. I'm getting a syntax error when i try and run
it. Any thoughts?
 
K

Keith

i think you're getting a syntax error because of this:
READY MIX - LF
make sure occurrences both have spaces before and after the "-"

--

Gary

I got it to work. Gary...you were correct...that was my problem. Thanks to NOPIK as well.

Keith
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top