ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to merge 2 ranges from to worksheets? (https://www.excelbanter.com/excel-programming/377288-how-merge-2-ranges-worksheets.html)

mikeb

How to merge 2 ranges from to worksheets?
 
What I want to do is take 2 ranges from 2 worksheets and create one range and
populate my udt array. The 2 ranges will have the same number of colums but
different amount of rows. I will use Find/FindNext to populate my udt based
on a list of unique id's that are in column A. I think I know how to do that
but not sure how to combine the 2 ranges. Can someone provide some code
examples? thanks a lot!


Dave Ramage

How to merge 2 ranges from to worksheets?
 
Mike,

Here's how I'd do it:

1) Copy both sets of data to a new sheet, one set below the other.
2) Sort by UniqueID
3) Add this R1C1 formula to the last column
=R[-1]C1=RC1 (assuming UniqueID is in first column)
All unique rows will now have False in last column
4) Sort by last column
5) Find first "True" in last column and delete all rows from here down (use
Find or Application.Index
6) Create your array from this data

Cheers,
Dave
"mikeb" wrote:

What I want to do is take 2 ranges from 2 worksheets and create one range and
populate my udt array. The 2 ranges will have the same number of colums but
different amount of rows. I will use Find/FindNext to populate my udt based
on a list of unique id's that are in column A. I think I know how to do that
but not sure how to combine the 2 ranges. Can someone provide some code
examples? thanks a lot!


Peter Huang [MSFT]

How to merge 2 ranges from to worksheets?
 
Hi,

Just want to say Hi, and I was wondering how everything is going.
Did Dave's suggestion help you?
If anything is unclear, please let me know.
It is my pleasure to be of assistance.


Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.



All times are GMT +1. The time now is 08:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com