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

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,021
Latest member
Mohamed Magdi Tawfiq Emam

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