VBA Checkbox.

alexub12

New Member
Joined
Jan 8, 2019
Messages
1
Hello all. I need help with the following.

I want to be able to add a checkbox to a specific Column-Cell everytime a row is inserted the checkbox should be added to the same row just on the new row that was added.

so far I have found plenty of material out there helping me figure out how to add a checkbox I just can't figure out how to add it on the new row.

if the only solution is to add a button to add a row when click, that is an acceptable solution.

thanks for the help in advance
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Put the following code in the events of your sheet


Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    celdas = Target.Count
    fila = Target.Row
    cuenta = WorksheetFunction.CountBlank(Rows(fila))
    If celdas = Columns.Count Then
        If cuenta = celdas Then
        
            ActiveSheet.CheckBoxes.Add(Left:=Range("D" & fila).Left, _
               Top:=Range("D" & fila).Top, Width:=Range("D" & fila).Width, _
               Height:=Range("D" & fila).Height).Select
               
            ActiveSheet.OLEObjects.Add "Forms.CheckBox.1", _
               Left:=Range("E" & fila).Left, Top:=Range("E" & fila).Top, _
               Width:=Range("E" & fila).Width, Height:=Range("E" & fila).Height


        End If
    End If
End Sub

When you insert a single row in column D of the new row a checkbox will be inserted and in column E an ActiveX checkbox will be inserted.

Try and tell me
 
Upvote 0
Just curious. Why do you need a checkbox added to each new row?
Will there be a script then used for the checkbox to do something?

You do know script can be run by just double clicking right clicking or many other ways without the need of a checkbox.
 
Upvote 0

Forum statistics

Threads
1,224,942
Messages
6,181,900
Members
453,068
Latest member
DCD1872

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top