I have a userform code that it runs perfect but it is very slow, and trying to make it run faster.
When I ran the code below, all combobox/optionbutton that have values in it show as TRUE on the overall sheet (Column A), or else if blank, it show false.
Instead of having all these line run one by one (it takes forever), I m trying to find a code to make it run only if the combobox is not blank (TRUE), and make the rest automatically show false on the overall sheet itself.
The intend is to make the code run faster.
This is only one portion of the code, but I do have a lot of lines with combobox.optionbutton.
When I ran the code below, all combobox/optionbutton that have values in it show as TRUE on the overall sheet (Column A), or else if blank, it show false.
Instead of having all these line run one by one (it takes forever), I m trying to find a code to make it run only if the combobox is not blank (TRUE), and make the rest automatically show false on the overall sheet itself.
The intend is to make the code run faster.
Code:
Private Sub CommandButton1_Click()
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Application.DisplayStatusBar = False
Application.EnableEvents = False
Dim ws As Worksheet
Set ws = Worksheets("Overall")
'copy the data to the database
With ws
.Cells(2, 1).Value = Me.SJ1.Value
.Cells(92, 1).Value = Me.SJ2.Value
.Cells(182, 1).Value = Me.SJ3.Value
.Cells(272, 1).Value = Me.SJ4.Value
.Cells(362, 1).Value = Me.SJ5.Value
.Cells(452, 1).Value = Me.SJ6.Value
.Cells(542, 1).Value = Me.SJ7.Value
.Cells(632, 1).Value = Me.SJ8.Value
.Cells(722, 1).Value = Me.SJ9.Value
.Cells(812, 1).Value = Me.SJ10.Value
.Cells(902, 1).Value = Me.SJ11.Value
.Cells(992, 1).Value = Me.SJ12.Value
.Cells(1082, 1).Value = Me.SJ13.Value
.Cells(1172, 1).Value = Me.SJ14.Value
.Cells(1262, 1).Value = Me.SJ15.Value
ActiveWorkbook.Save
Application.EnableEvents = True
Application.DisplayStatusBar = True
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
Unload Me
End With
End Sub
This is only one portion of the code, but I do have a lot of lines with combobox.optionbutton.