Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2004
    Posts
    23

    Exclamation Unanswered: VBA Code For Macro? II

    Then Next part is.

    In Cell A3 - A999
    I have a CHECK box

    I have another Button that Inserts a ROW in Cell A10 ( always )
    However - It will NOT put the CHECK box there? Here is the CODE:

    Rows("10:10").Select
    Selection.Insert Shift:=xlDown
    Range("I9:AF9").Select
    Selection.AutoFill Destination:=Range("I9:AF10"), Type:=xlFillDefault
    Range("I9:AF10").Select
    ActiveWindow.ScrollColumn = 11
    ActiveWindow.ScrollColumn = 1
    Range("A10").Select
    Application.CommandBars("Control Toolbox").Visible = True
    Range("A9").Select
    ActiveSheet.Shapes("CheckBox3").Select
    Range("A9").Select
    Selection.AutoFill Destination:=Range("A9:A10"), Type:=xlFillDefault
    Range("A9:A10").Select
    Application.CommandBars("Control Toolbox").Visible = False
    Range("B6").Select
    End Sub

    How DO I get the Check box to be populated in the NEW added row?

  2. #2
    Join Date
    Jan 2004
    Location
    Aberdeen, Scotland
    Posts
    1,067
    Hi

    Here is the code you want to insert a checkbox into the new row

    Code:
    Private Sub cmdInsert_Click()
        Dim MyWorksheet As Worksheet
        Set MyWorksheet = ActiveSheet
        
        'insert a row
        Range("A10").EntireRow.Insert
        'copy data down to new row
        Range("I10:AF10").Formula = Range("I9:AF9").Formula
    
        'Add Checkbox
        MyWorksheet.Shapes.AddOLEObject Left:=Range("A10").Left, Top:=Range("A10").Top, _
        Width:=Range("A10").Width, Height:=Range("A10").Height, _
        ClassType:="Forms.Checkbox.1"
    End Sub
    HTH
    David

  3. #3
    Join Date
    Jun 2004
    Posts
    23

    Almost perfect

    Whn I select that Button - The row is Inserted and the CHECKBOX is present however - It is a NAMED checkbox?

    The BOX then it says Checkbox 902

    All I would Like if the box - Where or how do I get rud of the name?

Posting Permissions

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