+ Reply to Thread
Results 1 to 7 of 7

Speed up the macro coding

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    09-15-2011
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    135

    Speed up the macro coding

    Hi All,

    Any one help me to fix the below mentioned macro to accelerate his speed, in that sheet contains more then 35 check boxes. If am select the "Select All" Option it will take a minute to select all the check boxes. so i need to fix that issue. Seeking your comments on this.

    Sub Check_Box()
    Application.Calculation = xlCalculationManual
            Application.ScreenUpdating = False
                    If Sheets("Filters").Shapes("Check Box 42").ControlFormat.Value = 1 Then
                    		For i = 43 To 76
                    Sheets("Filters").Shapes("Check Box " & i).ControlFormat.Value = True
                    		Next i
        Else
                    		For i = 43 To 76
                    Sheets("Filters").Shapes("Check Box " & i).ControlFormat.Value = False
            			Next i
                    End If
    Application.Calculation = xlCalculationAutomatic
    End Sub


    Thanks/Raju
    Last edited by rajuganapathy; 06-30-2019 at 09:54 PM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,777

    Re: Speed up the macro coding

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between [CODE] [/CODE] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    09-15-2011
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    135

    Re: Speed up the macro coding

    Hi Jeff, it's done. Thank you.

  4. #4
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Speed up the macro coding

    Is this faster?

    Option Explicit
    
    Sub Check_Box()
        Dim i As Long
    
        With Application
            .Calculation = xlCalculationManual
            .ScreenUpdating = False
            .EnableEvents = False
        End With
    
        With Sheets("Filters")
            If .Shapes("Check Box 42").ControlFormat.Value = 1 Then
                For i = 43 To 76
                    .Shapes("Check Box " & i).ControlFormat.Value = True
                Next i
            Else
                For i = 43 To 76
                    .Shapes("Check Box " & i).ControlFormat.Value = False
                Next i
            End If
        End With
    
        With Application
            .Calculation = xlCalculationAutomatic
            .EnableEvents = True
            .ScreenUpdating = True
        End With
    End Sub
    *******************************************************

    HELP WANTED! (Links to Forum threads)
    Trying to create reusable code for Custom Events at Workbook (not Application) level

    *******************************************************

  5. #5
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,692

    Re: Speed up the macro coding

    I doubt that it will be faster but who knows.
    Change references if and where required.
    Sub AAAAA()
    Dim a(33), i As Long, j As Long
    For i = 1 To 34
    a(i - 1) = "Check Box " & i + 42
    Next i
        If Sheets("Filters").Shapes("Check Box 42").ControlFormat.Value = 1 Then
            For j = LBound(a) To UBound(a)
                Sheets("Filters").Shapes(a(j)).ControlFormat.Value = True
            Next j
        Else
            For j = LBound(a) To UBound(a)
                Sheets("Filters").Shapes(a(j)).ControlFormat.Value = False
            Next j
        End If
    End Sub

  6. #6
    Forum Contributor
    Join Date
    09-15-2011
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    135

    Re: Speed up the macro coding

    Thank you very much for your kind response Jolivanes & mc84excel. it's working speedy ....

  7. #7
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Speed up the macro coding

    Quote Originally Posted by rajuganapathy View Post
    Thank you very much for your kind response Jolivanes & mc84excel. it's working speedy ....
    You don't have to rep me however could you please close the thread? Use Thread Tools (top right menu) to mark the thread as SOLVED. Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to avoid cell SELECTION but still format cells to speed up the macro running speed
    By BeefyBerts in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-05-2018, 08:18 AM
  2. Everage Speed km/time (european speed)
    By GerryZucca in forum Excel General
    Replies: 3
    Last Post: 02-23-2015, 03:02 PM
  3. How to make VBA offset and speed up coding
    By Toyo613 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-05-2014, 10:34 AM
  4. macro coding help (i have no background in coding)
    By notgoodenough in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-05-2014, 10:22 PM
  5. [SOLVED] Vb macro coding for transpose - complete coding?
    By Dharani Suresh in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 08-02-2013, 11:16 PM
  6. [SOLVED] Vb macro coding for transpose - complete coding?
    By Dharani Suresh in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-02-2013, 05:04 AM
  7. [SOLVED] Implant macro coding into ASP coding
    By Sam yong in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-15-2005, 06:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1