Coding Efficiency

Im_Yellow

New Member
Joined
Apr 25, 2014
Messages
16
Hi People,

I'm looking to Improve the efficiency of my code.

I have two ActiveX Command Buttons, that, when clicked set 50-ish ActiveX Checkboxes to be TRUE or FALSE depending which button is clicked.

At the moment the code ticks each checkbox singularly and moves to the next, which is a bit clunky and makes my screen flash wildly (Dangerous for any Epilepsy sufferers)

My code is as follows;

Private Sub HideAll_Click()
Infrastructure = False
Adobe = False
. etc
. etc
. etc
. etc
WorkstationsAccessories = False
End Sub

and obvisously all TRUE for the 'ShowAll' Button,

Is there a way to make this more efficient? Or do i have to settle with losing my sight at an early age from the blinding flashes?

thanks,

Yellow
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
before
Code:
with application.
screenupdating = false
end with


after
Code:
with application.
screenupdating = true
end with

is one step, more can be done if necessary
 
Upvote 0
This code will cycle through all the activex checkboxes on a worksheet and set them all to true.

Code:
Sub cyclecheckboxes()

Dim oleObj As OLEObject
Application.ScreenUpdating False
For Each oleObj In Sheets("Sheet1").OLEObjects
    If TypeName(oleObj.Object) = "CheckBox" Then
        oleObj.Object = True
    End If
    
Next
Application.ScreenUpdating True
End Sub
 
Upvote 0
Using a listbox which is set up to display a checkbox for each item listed might work a bit better.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,111
Messages
6,128,899
Members
449,477
Latest member
panjongshing

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