Hello
I need some help i want to copy entire rows using checkbox in sheet KFHUP here in this example, and paste it in to sheet Hurtig Calc start with row 19, and past next below, the problem is when it comes to row 33 it need insert a row for next
Hello
I need some help i want to copy entire rows using checkbox in sheet KFHUP here in this example, and paste it in to sheet Hurtig Calc start with row 19, and past next below, the problem is when it comes to row 33 it need insert a row for next
Possibly this will work for you...Sub Test() Dim cb As Shape, s As Shape, rg As Range For Each cb In Worksheets("KFHUP").Shapes If cb.FormControlType = xlCheckBox Then If cb.ControlFormat.Value = xlOn Then Set rg = cb.TopLeftCell.EntireRow 'placement of checkboxes is critical With Worksheets("Hurtig Calc") .Rows(19).EntireRow.Insert rg.Copy .Rows(19) 'removes transferred checkboxes For Each s In .Shapes s.Delete Next End With End If End If Next cb End Sub
Hello
Thank you this is what i was looking for, but there is a problem, it seems it copy same row several times
i did one klikk on all boxes when i downloaded your file, here is the result
The code as written, does not delete any data. It simply appends to the top of the list. If you run it twice it will duplicate the transferred data.
Hello
Ok, i am thinking to copy one row for each checkbox
In this worksheet, there are 4 checkboxes. I've run the code once and you can see the 4 rows copied. Uncheck some of the checkboxes and run it again...
Hello
Now i understand, my misstake, in my head i assign the code to each checkbox, but ok i make a buttom and assign the code to that
Thank you
I modified the code if you're putting a button on the results sheet...Sub Test() Dim cb As Shape, s As Shape, rg As Range For Each cb In Worksheets("KFHUP").Shapes If cb.FormControlType = xlCheckBox Then If cb.ControlFormat.Value = xlOn Then Set rg = cb.TopLeftCell.EntireRow 'placement of checkboxes is critical With Worksheets("Hurtig Calc") .Rows(19).EntireRow.Insert rg.Copy .Rows(19) 'removes transferred checkboxes For Each s In .Shapes If s.FormControlType = xlCheckBox Then s Delete Next End With End If End If Next cb End Sub
Hello
i get an error here xlCheckBox Then s Delete
What's the error?
Hello
Here is the picture
My error. Should be a dot instead of a space between the s and delete.If s.FormControlType = xlCheckBox Then s.Delete
Hello
Thank you for the kindness, I will now try to add more sheets, i assume that work to
The modify delete the buttom ?
Last edited by dodde; 06-10-2020 at 01:08 PM.
The code should work on similar worksheets. If not, let us know!
Hello
this become perfect for me, Thanks again
I also added this for unchecked to the end
ActiveSheet.CheckBoxes.Value = False Application.ScreenUpdating = True
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks