Why Excell commandbutton macro is too slow?

Shayanan

New Member
Joined
Feb 11, 2021
Messages
8
Office Version
  1. 2019
Platform
  1. Windows
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:

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:

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Why Excell commandbutton macro is too slow?
If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,906
Members
452,366
Latest member
TePunaBloke

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