Macro to copy data from 1 wrksheet to another

[Closed]
Report
-
Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
-
Hello,

Here is my situation. I have a workbook that has two sheets. The first sheet returns a set of cell values based on a link to an external database. What I need help figuring out is what function/macro can I use to copy Column A (Division) and Column B (Location) from the returned data set into the second worksheet regardless of the range of data because the values that the function/macro populates on the second sheet will then be used to return data from a second external database.

Ex:

In 2012 I run my script to pull data from the external database into the first worksheet. The returned values are as follows:

Division Location

110 210
120 220
130 230

The second sheet pulls those values into specific columns which in turn are used to return data from the second external database.

In 2013 I run the same script to return data and get the following results:

Division Location
110 210
120 220
130 230
140 240
150 250

Basically, I need to ensure that no matter if there are more or less returned values from the first worksheet, my second worksheet will always capture each data set in order to be used to return data from the second external database.

1 reply

Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
768
If I got this one right, all you want to do is that in year 2013, have the 2nd work book add these two rows
140 240
150 250

Also case you did not mention, but I am guessing had in 2013 you did not had 120 220
you would still would like to keep it in 2ns sheet (or may be delete)
Is that so ?