+ Reply to Thread
Results 1 to 4 of 4

How to give checkboxes a specific size or alignment?

Hybrid View

Kimberley How to give checkboxes a... 11-24-2011, 12:33 PM
StephenR Re: How to give checkboxes a... 11-24-2011, 12:44 PM
romperstomper Re: How to give checkboxes a... 11-24-2011, 12:46 PM
Kimberley Re: How to give checkboxes a... 11-24-2011, 01:03 PM
  1. #1
    Registered User
    Join Date
    11-24-2011
    Location
    Home
    MS-Off Ver
    Excel 2007
    Posts
    20

    Question How to give checkboxes a specific size or alignment?

    Hi,

    I'm facing a little problem with a code that creates checkboxes. As you can see on the following picture, my data validation arrows are hidden by the checkboxes created by my code.

    \1

        For lign = 1 To [Q6].Value
                
            posX1 = Cells(lign + 1, 7).Left
            posY1 = Cells(lign + 1, 7).Top
            width1 = Cells(lign + 1, 7).Width
            height1 = Cells(lign + 1, 7).Height
            With ActiveSheet.CheckBoxes.Add(posX1, posY1, width1, height1)
                .LinkedCell = Cells(lign + 1, 13).Address
                .Characters.Text = "Accompagnied by"
                .Name = "Accompagnied " & lign
            End With
    
        Next lign
    In this code, the checkboxes are created to fit the G col. How can I move it a little to the right so I can have access to the list arrow, and reduce its size to the left of the same amount so it doesn't overlap on the H column?

    Thanks in advance.

    PS: you may have to click on "create list" and then "reset" twice or 3 times to get this overlapping issue.
    Last edited by Kimberley; 11-30-2011 at 06:38 AM.

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: How to give checkboxes a specific size or alignment?

    If you increase the xpos by 13 seems to do the trick?

  3. #3
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,015

    Re: How to give checkboxes a specific size or alignment?

    Try this - you can tweak the lOffset value as needed:
    Private Sub CreateTheList_Click()
    
        Dim n As Integer
        Dim cel As Range
        Const lOffset As Double = 10
        
        On Error Resume Next
        
        Application.ScreenUpdating = False
        Application.Calculation = xlCalculationManual
        
        For n = 1 To [Q6].Value - 1
            Range("F" & n + 1).AutoFill Destination:=Range("F" & n + 1 & ":F" & n + 2), Type:=xlFillDefault
            Range("H" & n + 1).AutoFill Destination:=Range("H" & n + 1 & ":H" & n + 2), Type:=xlFillDefault
        Next n
        
        For lign = 1 To [Q6].Value
                
            posX1 = Cells(lign + 1, 7).Left + lOffset
            posY1 = Cells(lign + 1, 7).Top
            width1 = Cells(lign + 1, 7).Width - lOffset
            height1 = Cells(lign + 1, 7).Height
            With ActiveSheet.CheckBoxes.Add(posX1, posY1, width1, height1)
                .LinkedCell = Cells(lign + 1, 13).Address
                .Characters.Text = "Accompagnied by"
                .Name = "Accompagnied " & lign
            End With
    
        Next lign
        
        Application.Calculation = xlCalculationAutomatic
        Application.ScreenUpdating = True
    
    End Sub
    Everyone who confuses correlation and causation ends up dead.

  4. #4
    Registered User
    Join Date
    11-24-2011
    Location
    Home
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: How to give checkboxes a specific size or alignment?

    Thanks!

+ Reply to Thread

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