Consulting

Results 1 to 3 of 3

Thread: create a new checkbox and assign its ID?

  1. #1

    create a new checkbox and assign its ID?

    How do I assign an ID to a checkbox?
        With ActiveSheet
            .CheckBoxes.Add(740, 270, 75, 15).Select
            .CheckBoxes.Add(Cells(r, "L").Left + 20, Cells(r, "L").Top, 85, 15).Text = "Continuous"
        End With
    Right now VBA is using default CheckBox1, 2, 3, etc., but I need to be more specific.

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    Not sure what you mean by ID. This shows how to set the Name and Text properties.

    Sub k()
      With ActiveSheet
          Dim r As Long, cb As Object
          r = 17
          Set cb = .CheckBoxes.Add(740, 270, 75, 15)
          cb.Name = "cb 1"
          cb.Text = "Ken's cb 1"
          Set cb = .CheckBoxes.Add(Cells(r, "L").Left + 20, Cells(r, "L").Top, 85, 15)
          cb.Name = "cb 2"
          cb.Text = "Ken's cb 2"
      End With
    End Sub

  3. #3
    Exactly what I was looking for, thank you!

Posting Permissions

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