auto added checkbox

niailmar

New Member
Joined
May 22, 2012
Messages
11
Hello everyone. I wanna ask about this problem:


I have a table of data(Sheet1), which all the data will retrieve from physical folder (C:/Data).
(as attach image)


My problem are:


1) When new data retrieved, a checkbox will automatically add, at the end of the column. The new data will be inserted row by row.
2) When the checkbox is ticked, send the ticked data to another sheet (Sheet2).
At the Sheet2, there have two column. So, both of two column is need to be automatically ticked when the checkbox at Sheet1 have ticked.




I appreciate your help to solve my problem.

-nia
attachment.php
-
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
I can suggest you a method to add check boxes. The "OnAction" property points to Sub which will be run when check box is ticked.

Code:
Sub AddCheckBoxes()
    Dim sh1 As Worksheet
    Dim i As Long, lr As Long
    
    Set sh1 = Worksheets("Sheet1")
    lr = sh1.Cells(sh1.Rows.Count, 1).End(xlUp).Row
    
    For i = 1 To lr
        With Cells(i, 5)
            With sh1.CheckBoxes.Add(.Left, .Top, .Width, .Height)
                .Value = True
                .Caption = vbNullString
                .Name = "chkRow" & i
                .OnAction = "DoSomeAction"
            End With
        End With
    Next
End Sub

Sub DoSomeAction()
    MsgBox Worksheets("Sheet1").CheckBoxes(Application.Caller).Name
End Sub
 
Upvote 0

Forum statistics

Threads
1,203,145
Messages
6,053,753
Members
444,681
Latest member
Nadzri Hassan

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