Results 1 to 4 of 4

Excel 2010 and checkbox : very slow ?

Threaded View

  1. #1
    Registered User
    Join Date
    06-12-2013
    Location
    France
    MS-Off Ver
    Excel 2007
    Posts
    2

    Excel 2010 and checkbox : very slow ?

    Hi

    I wrote some times ago a macro that add checkboxes in a sheet (I found some part on the net)
    On Office 2003 and 2007, no trouble at all. But in office 2010, the same macro is now very slow
    here is an example that add a checkbox on 800 rows
    Sub Macro1()
    Dim l2, i As Integer
    Dim r As Range
    Dim Data As Range
    Dim dtmTest As Date
    Dim dtmTest2 As Date
    
      
        l2 = 800
            
        dtmTest = TimeValue(Now)
        
        i = 0
        Set Data = Range("F3:F" & l2)
        For Each r In Data
            i = i + 1
            Set Cbox = ActiveSheet.CheckBoxes.Add(r.Left + 4, r.Top, r.Width, r.Height)
            With Cbox
               .Value = xlOn
                .LinkedCell = "$G$" & r.Row
                .Display3DShading = True
                .Caption = "ACTIF"
            End With
        Next r
        
        dtmTest2 = TimeValue(Now)
            
        MsgBox (DateDiff("s", dtmTest, dtmTest2))
    End Sub
    it takes 220 seconds to perform the macro in Excel 2010 and only 17 seconds in Excel 2007 !
    If I comment the .value, .LinkedCell and .Display3DShading lines, it only takes 12 secondes in Excel 2010 (but if one of these three lines is present in the code, the macro takes again more than 200 seconds). So it seems this part of the code has a problem ... but I'm unable to find why !

    Is there another way to quickly create checkboxes and modify their properties ?

    Regards
    Last edited by ilive; 06-12-2013 at 02:51 PM.

Thread Information

Users Browsing this Thread

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

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