Slow Code

kulmjord

Board Regular
Joined
Jul 9, 2015
Messages
53
Hey guys,
Code:
Private Sub CheckBox13_Click()
Application.ScreenUpdating = False
Dim cell As Range
Dim InputValue As String
On Error Resume Next
Range("I8,I11,I14,I20,I23,I27,I33").Select
    If CheckBox13.Value = True Then
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .ThemeColor = xlThemeColorAccent3
        .TintAndShade = 0.599993896298105
        .PatternTintAndShade = 0
        For Each cell In Selection
        If IsEmpty(cell) Then
            cell.Value = "Enter"
        End If
    Next
    End With
    Else
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .ThemeColor = xlThemeColorLight2
        .TintAndShade = 0.799981688894314
        .PatternTintAndShade = 0
        For Each cell In Selection
        If cell.Value = "Enter" Then
            cell.Value = ""
        End If
    Next
    End With
        If CheckBox14.Value = True Then
            Range("I27,I33").Select
            With Selection.Interior
                .Pattern = xlSolid
                .PatternColorIndex = xlAutomatic
                .ThemeColor = xlThemeColorAccent3
                .TintAndShade = 0.599993896298105
                .PatternTintAndShade = 0
           For Each cell In Selection
        If IsEmpty(cell) Then
            cell.Value = "Enter"
        End If
    Next
            End With
        End If
    End If
Range("I8").Select
End Sub

Above is the code that I am using for a project. The basics of it is I am getting a couple of boxes to become highlighted and the word "Enter" appear when a checkbox is checked. Also, if there is data already in the cell then it is only highlighted in order to keep the data. It works as it is but because there are a lot of checkboxes, it is very tasking on the PC to even open the file. Any suggestions as to reducing the amount of code and making it more efficient is much appreciated.

Thanks,
Kulmjord.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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