Other ways to improve user form speed

VBE313

Well-known Member
Joined
Mar 22, 2019
Messages
686
Office Version
  1. 365
Platform
  1. Windows
I need some tips on how to improve the user form speed besides application.screenupdating, .enableevent, and .calculationmanual
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
I would think we need to see the code your trying to run in your UserForm.
And how do you define speed?
Is your script taking 5 seconds or .005 seconds


I need some tips on how to improve the user form speed besides application.screenupdating, .enableevent, and .calculationmanual
 
Upvote 0
Please do not judge my coding, I am fairly new, here is my code


Code:
Private Sub CommandButtonBend_Click()
    Application.ScreenUpdating = False
    Load BOM_Standard_Costs_Template
    If ActiveCell.Column = 3 And ActiveCell.Row >= 3 Then
    With Selection
    Application.Run "AddRow"
    Application.Run "NoIndent"
    Selection.Value = "BENDING"
    ActiveCell.Offset(0, 2).Value = "Press Brake"
    ActiveCell.Offset(0, 3).Value = "MIN"
    ActiveCell.Select
    End With
    Else
    End If
    Application.ScreenUpdating = True
    End Sub
Private Sub CloseButton_Click()
Unload Me
End Sub
Private Sub CommandButtonFloorSignOff_Click()
     Application.ScreenUpdating = False
    Load BOM_Standard_Costs_Template
  If ActiveCell.Column = 3 Then
    With Selection
    Application.Run "AddRow"
    Application.Run "NoIndent"
    Selection.Value = "FINAL INSPECTION"
    ActiveCell.Offset(0, 2).Value = "Inspection"
    ActiveCell.Offset(0, 3).Value = "MIN"
    ActiveCell.Select
    End With
    Else
    End If
    Application.ScreenUpdating = True
End Sub
Private Sub CommandButtonFinal_Click()
Load BOM_Standard_Costs_Template
 Application.ScreenUpdating = False
  If ActiveCell.Column = 3 Then
    With Selection
    Application.Run "AddRow"
    Application.Run "NoIndent"
    Selection.Value = "DIMENSIONAL INSPECTION"
    ActiveCell.Offset(0, 2).Value = "Inspection"
    ActiveCell.Offset(0, 3).Value = "MIN"
    ActiveCell.Select
    End With
    Else
    End If
    Application.ScreenUpdating = True
End Sub
Private Sub CommandButtonLaserCutting_Click()
Load BOM_Standard_Costs_Template
 Application.ScreenUpdating = False
  If ActiveCell.Column = 3 Then
    With Selection
    Application.Run "AddRow"
    Application.Run "NoIndent"
    Selection.Value = "LASER CUTTING"
    ActiveCell.Offset(0, 2).Value = "Laser Cut"
    ActiveCell.Offset(0, 3).Value = "SQ IN"
    ActiveCell.Select
    End With
    Else
    End If
    Application.ScreenUpdating = True
End Sub


Private Sub CommandButtonVirtek_Click()
Load BOM_Standard_Costs_Template
     Application.ScreenUpdating = False
  If ActiveCell.Column = 3 Then
    With Selection
    Application.Run "AddRow"
    Application.Run "NoIndent"
    Selection.Value = "VIRTEK INSPECTION"
    ActiveCell.Offset(0, 2).Value = "Inspection"
    ActiveCell.Offset(0, 3).Value = "MIN"
    ActiveCell.Select
    End With
    Else
    End If
     Application.ScreenUpdating = True
End Sub
Private Sub CommandButtonWelderA_Click()
Load BOM_Standard_Costs_Template
 Application.ScreenUpdating = False
  If ActiveCell.Column = 3 Then
    With Selection
    Application.Run "AddRow"
    Application.Run "NoIndent"
    Selection.Value = "WELDER - A"
    ActiveCell.Offset(0, 2).Value = "Welder - A"
    ActiveCell.Offset(0, 3).Value = "MIN"
    ActiveCell.Select
    End With
    Else
    End If
     Application.ScreenUpdating = True
End Sub
Private Sub CommandButtonWelderB_Click()
Load BOM_Standard_Costs_Template
 Application.ScreenUpdating = False
  If ActiveCell.Column = 3 Then
    With Selection
    Application.Run "AddRow"
    Application.Run "NoIndent"
    Selection.Value = "WELDER - B"
    ActiveCell.Offset(0, 2).Value = "Welder - B"
    ActiveCell.Offset(0, 3).Value = "MIN"
    ActiveCell.Select
    End With
    Else
    End If
     Application.ScreenUpdating = True
End Sub
 
Last edited by a moderator:
Upvote 0
Minimise the number of accesses to the worksheet as far as possible. often the best way of doing this is to load a range into a variant array and access the array rather than a worksheet range. If your code loops through a range of cells on a worksheet it will be slow. doing by loading the worksheet into an arary is usually about 500 to 1000 times faster for any long loop
 
Upvote 0
Change formulas by macros.
Delete blank cells that are no longer used.
Remove leaves that do not use.
Remove conditional formats from the sheets.
Remove images from your userform.
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,265
Members
452,627
Latest member
KitkatToby

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