+ Reply to Thread
Results 1 to 2 of 2

Dynamically Added Checkboxes; showing Check Mark on diff sizes

Hybrid View

  1. #1
    Registered User
    Join Date
    12-30-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    40

    Smile Dynamically Added Checkboxes; showing Check Mark on diff sizes

    Hello there,

    I have been adding checkbox dynamically.

    Everything looks good, but when I check the Boxes; the Check mark looks different sizes (See Attachments)

    Bellow is the subroutinue used for when UserForm initialize.

    Thank you in advance,

    Ernie

    Private Sub UserForm_Initialize()
    
    Dim lastcol  As Long
    Dim lastrow  As Long
    
    Dim r1 As Long
    Dim top As Integer
    
    Dim RangeLastCell As Range
    Dim SeasonName As String
    Dim SeasonCode As String
    Dim YearCode As String
    
    Dim iIndex As Long
    Dim myCheckBox As msforms.CheckBox
      
      Run "GetSeasons"
      
      top = 15
      
      With SubmitButton
        .Enabled = False
      End With
     
     Set RangeLastCell = ActiveWorkbook.ActiveSheet.Range("A1").SpecialCells(xlCellTypeLastCell)
     
     lastrow = RangeLastCell.Row
     lastcol = RangeLastCell.Column
      
      For iIndex = 1 To (lastrow - 1)
      
          r1 = iIndex + 1
    
          Set myCheckBox = UserForm1.Controls.Add("Forms.CheckBox.1")
          
          top = top + 35
          With myCheckBox
        
             .Left = 20
             .top = top
             .Height = 20
             .Width = 100
             .Font.Size = 12
             .Visible = True
             
             SeasonCode = ActiveSheet.Range("B" & CStr(r1)).Value
             YearCode = Mid(ActiveSheet.Range("B" & CStr(r1)).Value, 2, 2)
             
             If Left(SeasonCode, 1) = "F" Then
               SeasonName = "Fall"
             End If
             
             If Left(SeasonCode, 1) = "S" Then
               SeasonName = "Spring"
             End If
             
             .Name = SeasonCode
             
             .Caption = SeasonName & " " & YearCode
             
             ReDim Preserve eCheck(1 To iIndex)
             Set eCheck(iIndex).EditCheck = myCheckBox
          
          End With
          
          Set myCheckBox = Nothing
    
     Next
      
    End Sub
    endofseasonsPic.jpg

  2. #2
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: Dynamically Added Checkboxes; showing Check Mark on diff sizes

    Excel's checkbox sizes have been flakey for years. I don't think it has anything to do with creating them from code.

+ 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. Replies: 2
    Last Post: 10-28-2013, 03:52 PM
  2. Excel 2010 added shadowboxes to checkboxes?!
    By tfield98 in forum Excel General
    Replies: 3
    Last Post: 02-07-2013, 04:17 PM
  3. dynamically added rows
    By johnzm in forum Excel General
    Replies: 6
    Last Post: 05-16-2010, 07:05 AM
  4. Problems selecting a dynamically added chart
    By FunkyFox in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-28-2010, 03:05 PM
  5. Replies: 3
    Last Post: 04-13-2005, 05:52 PM

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