Copy paste data in immediate next blank row

Tarek_CTG

Board Regular
Joined
Apr 27, 2015
Messages
160
Office Version
  1. 2016
Platform
  1. Windows
I need 2 vba codes for below 2 functions:

01. I have a vba code for copy paste some data from one sheet of to another sheet like below:

Code:
wbA.Sheets("DC Low").Range("B:J").Copy wbB.Sheets("DC Low").Range("B:J")

Now, every time new data comes at wsA workbook. I have to paste this new data to exactly immediate next row in wsB sheet after previous data.

For example: imagine at first, there is 10 row of data in wbA.Sheets("DC Low") covering Range("B2:J11"). First, after running macro, it will copy this to wbB.Sheets("DC Low") covering Range("B2:J11").

Next, new data will come in wbA.Sheets("DC Low"). Imagine it contains 20 row of data in wbA.Sheets("DC Low") covering Range("B2:J21"). Now, after running macro, it will copy this to wbB.Sheets("DC Low") covering Range("B12:J31") that is starting from the immediate blank rows after previous saved data.

Now, how can I will do it ? What will be the code?

02. In same macro, my A column is empty. In wbB.Sheets("DC Low"), A column will take a value from E1 cell of wbA.Sheets("DC Low").

For example, imagine E1 = "01" in wbA.Sheets("DC Low"), and there is 10 row of data in wbA.Sheets("DC Low") covering Range("B2:J11"). So, after running macro, in wbB.Sheets("DC Low"), all of "A2:A11" cells will show "01".

What will be the code? Thanks in Advance.
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,215,640
Messages
6,125,977
Members
449,276
Latest member
surendra75

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