Other ways to improve user form speed

VBE313

Well-known Member
Joined
Mar 22, 2019
Messages
645
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
 

Some videos you may like

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
16,823
Office Version
  1. 2013
Platform
  1. Windows
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
 

VBE313

Well-known Member
Joined
Mar 22, 2019
Messages
645
Office Version
  1. 365
Platform
  1. Windows
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:

offthelip

Well-known Member
Joined
Dec 23, 2017
Messages
1,451
Office Version
  1. 2010
Platform
  1. Windows
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
 

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
12,593
Office Version
  1. 2007
Platform
  1. Windows
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,108,960
Messages
5,525,913
Members
409,671
Latest member
nasseralateek

This Week's Hot Topics

Top