Macro for command button to copy + paste on each click next row from table to another table

ColdSpirit

New Member
Joined
Sep 30, 2022
Messages
18
Office Version
  1. 2010
Platform
  1. Windows
Hey everyone,
hope you are all fine.
I have 2 Tables:
MasterTable
UsadasTable
I need, on each click on command button, to cut values on MasterTable B4/C4/D4 and paste to UsadasTable I4/J4/K4
On the next click, i need cut the values of the next row from MasterTable B5/C5/C5 and paste to UsadasTable I5/J5/K5, then on each click repeat until there is no more data.

1668799335883.png


Many thanks in advance.
And have a great weekend.
 
Hello again,
with the last code, it is not working. When i click the cmd button it just doesn't do anything
I think you are missing something as I tested the code with dummy data on columns E & J.
Check the sheet reference is correct. Then add some break points and run the debugger to watch the variables step by step.
 
Upvote 0

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Ok, i tested in a dummy sheet.
i tried to start on the cell E5 and it didnt work.
When i inserted data on cell E1 it worked however it was pasting not on J1 but on J2.

1669289997645.png


How can i bypass this?

Thank you =)
 
Upvote 0
As per your screenshots and code provided. You asked for a copy from column E to column J with headers on columns E and J, starting from headers on row 4.

It works within that context, here's a video.

I can't help you anymore on this one, there are plenty of people on this forum much more experienced than me so you will need to seek them out. Goodluck.
AWB copy paste.gif
ZI
 
Upvote 0
As per your screenshots and code provided. You asked for a copy from column E to column J with headers on columns E and J, starting from headers on row 4.

It works within that context, here's a video.

I can't help you anymore on this one, there are plenty of people on this forum much more experienced than me so you will need to seek them out. Goodluck.
View attachment 79471ZI
Hello again,
I understand now! Thank you for showing graphically!

The problem was the row number I was using!
I tested on row 4, and it worked!
I will modify my layout to accommodate the data from row 4!

Thank you so much! You helped me a lot!
 
Upvote 0

Forum statistics

Threads
1,223,952
Messages
6,175,596
Members
452,658
Latest member
GStorm

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