If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > VBA Code For Macro? II

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-09-04, 16:08
scobad scobad is offline
Registered User
 
Join Date: Jun 2004
Posts: 23
Exclamation 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?
Reply With Quote
  #2 (permalink)  
Old 06-10-04, 10:26
DavidCoutts DavidCoutts is offline
Registered User
 
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
Reply With Quote
  #3 (permalink)  
Old 06-10-04, 11:15
scobad scobad is offline
Registered User
 
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?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On