Commandbutton to copy based on CheckBox True/False

TDNova

New Member
Joined
Apr 16, 2018
Messages
45
Hello, im trying to figure out how to make this work.

I got a table with informaton. with a checkbox on the side of the table.
simply explained:
When the checkbox on the row is true, copy table row "b3:p3" to a new table.
but i want it to be activated by a commandbutton, so i can choose 5 checkboxes before it starts to copy.

Is there a way for it to work without linking each and every checkbox to the cells?

I do not have enough knowlegde in excel to know which approach is best suited here.
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Ive added another column before the checkbox that show true/false, baed on checked or not.

if a3 = true copy c3:q3 to another table should be possible ?
 
Upvote 0
I suggest we use a Double click sheet event script.
Requires no checkboxes or command buttons.
When you double click on any cell in column A this row will be copied to Other table

But we need to know the name of the other table name

When you talk about tables we always need the table names. Saying other table is not specific.

And you said:
copy table row "b3:p3"

We have no rows named b3 or p3
I assume you mean cells b3:p3
 
Upvote 0
Sorry for a late reply, didn't expect such a fast answer.

That sounds interesting, but the main problem is the user base that is going to use it. it would be much better for them to use a checkbox.

First table > Lageroversikt

Second table > Orderoversikt


Yes, that was badly explained from my side, i meant from cell c3 to cell r3.
 
Upvote 0
I suggest we use a Double click sheet event script.
Requires no checkboxes or command buttons.
When you double click on any cell in column A this row will be copied to Other table
But i can give it a try, but ive never used that function before. didn't even know about it. if you need additional information just tell me.

first table "Lageroversikt" starts at c2 " header" and the first cell with information on c3. ends at column r

second table "Orderoversikt" starts at t42 "header"and the first cell with information on t43. ends at column AI "a.i"
 
Last edited:
Upvote 0
Thanks for your time, additonal question.
since you can double click to add to another table, can you also double click to remove from the other table ?
 
Upvote 0
Lets try this as a test

I need you to double click on the first cell in the row you want copied to other table
So I believe from your original post it will be column B

And this script will copy column b to P to table named Orderoversikt

See how this works and we can modify script if needed

So if you double click on Range("B2") The Range("B2:P2") will be added to table
Orderoversikt

We can work on deleting ranges later
This is an auto sheet event script
Your Workbook must be Macro enabled
To install this code:
Right-click on the sheet tab
Select View Code from the pop-up context menu
Paste the code in the VBA edit window

Code:
[LEFT][COLOR=#222222][FONT=Verdana]Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]'Modified 5/29/18 5:20 AM EDT[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]Cancel = True[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]Dim Lastrow As Long[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]Dim r As Long[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]Dim c As Long[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]Lastrow = ActiveSheet.ListObjects("Orderoversikt").Range.Rows.Count + 1[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]r = ActiveCell.Row[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]c = ActiveCell.Column[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]Cells(r, c).Resize(, 15).Copy ActiveSheet.ListObjects("Orderoversikt").Range.Cells(Lastrow, 1)[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]End Sub[/FONT][/COLOR][/LEFT]
 
Upvote 0
I made one mistake. You will see its copying the data over but it's not adding rows to the table.
So next time it will over write previously pasted data. I have now fixed that.

I could have it copying over five rows at one time if you wanted that.
So if you double clicked on column B that row and the 4 below would be copied over.
Just let me know.
 
Upvote 0
Do i make a new module and just paste it inn. and change the worksheet name to mine ?
because when i double click on the row, nothing happens.

No, that is fine. because this is going to be a "order" list.
so it should work fine, someone will go over the list and choose one row at the time to the new list.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,170
Members
453,021
Latest member
Justyna P

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