I Use a 1200 line module code for 22 commandbutton. when click each one of button, it fulfill 10 cell value. But it is too slow.
is there a way to optimize code?
this is one of 22 button code:
is there a way to optimize code?
this is one of 22 button code:
VBA Code:
Sub Iron_Condor()
'
' Iron_Condor Macro
'
'
Range("R38").Select
ActiveCell.FormulaR1C1 = "Iron Condor"
ActiveWindow.SmallScroll Down:=14
Range("D47").Select
ActiveCell.FormulaR1C1 = "100"
Range("E48").Select
ActiveCell.FormulaR1C1 = "'-Select-"
Range("D49").Select
ActiveCell.FormulaR1C1 = "'-Select-"
Range("E50").Select
ActiveCell.FormulaR1C1 = "100"
Range("E51").Select
ActiveCell.FormulaR1C1 = "5"
Range("D52").Select
ActiveCell.FormulaR1C1 = "1"
Range("E48").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.FillRight
Range("D49").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.FillRight
Range("E50").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.FillRight
Range("E51").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.FillRight
Range("D52").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.FillRight
Range("E48").Select
ActiveCell.FormulaR1C1 = "'Put"
Range("F48").Select
ActiveCell.FormulaR1C1 = "'Put"
Range("G48").Select
ActiveCell.FormulaR1C1 = "'Call"
Range("H48").Select
ActiveCell.FormulaR1C1 = "'Call"
Range("E49").Select
ActiveCell.FormulaR1C1 = "'Long"
Range("F49").Select
ActiveCell.FormulaR1C1 = "'Short"
Range("G49").Select
ActiveCell.FormulaR1C1 = "'Short"
Range("H49").Select
ActiveCell.FormulaR1C1 = "'Long"
Range("E50").Select
ActiveCell.FormulaR1C1 = "90"
Range("F50").Select
ActiveCell.FormulaR1C1 = "98"
Range("G50").Select
ActiveCell.FormulaR1C1 = "102"
Range("H50").Select
ActiveCell.FormulaR1C1 = "110"
Range("E51").Select
ActiveCell.FormulaR1C1 = "2"
Range("F51").Select
ActiveCell.FormulaR1C1 = "4"
Range("G51").Select
ActiveCell.FormulaR1C1 = "4"
Range("H51").Select
ActiveCell.FormulaR1C1 = "2"
Range("D47").Select
ActiveWindow.SmallScroll Down:=-140
End Sub
Last edited by a moderator: