combining information from 2 ranges

Posted on 2007-07-21
Last Modified: 2010-04-23
I have a VB,NET 2005 application.
It uses Excel Automation
I have 2 ranges:

oRange1 = oSheet.Range("A23:A29")
oRange2 = oSheet.Range("E20:E:26")

And a subroutine
Private Sub PrintValues(ByVal  MyRange As Range)

I need to concatenate the two ranges into one range in order to be able to use the subroutine

How do I acomplish that ?

A simple way to visualize it would be
oRange = oRange1 + oRange2
oRange = oRange1 & oRange2

I understand that this might be a problem because the ranges might have diffrent dimensions.

How can i do it if I know that each oRange is a 1 column range ?
How can I copy the information into such new range containing all the data ?

Question by:Mafalda
    1 Comment
    LVL 10

    Accepted Solution

    Use Application.Union method to combine your ranges


    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
    Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now