+ Reply to Thread
Results 1 to 2 of 2

Union Range Problem

  1. #1
    Registered User
    Join Date
    05-19-2014
    Posts
    1

    Union Range Problem

    Hi All,

    I am trying to create a union range that is comprised of two cells that are no where near each other on a worksheet. I keep getting the object required error. Everything else works perfectly, any ideas?

    Dim myRng As Range
    Set myRng = Application.Union((Range("IndData1")), (Range("IndData2"))).Activate
    Do Until ActiveCell = ""
    Selection.Copy
    Selection.Offset(0, 1).Activate
    Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Selection.Offset(RowOffset:=0, ColumnOffset:=-1).Activate
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    ActiveCell.Offset(-1, 1).Activate
    Loop

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Union Range Problem

    Change this...
    Please Login or Register  to view this content.

    To this...
    Please Login or Register  to view this content.
    I don't follow what the rest of your code is intending to do. You define myRng with the Union command, but do not use it later in the code.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Union non-contiguous range
    By cokillerliu in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-02-2013, 10:38 AM
  2. [SOLVED] Range/union
    By Dibbley247 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-22-2013, 10:35 AM
  3. union range problem
    By Walter in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-12-2006, 07:35 PM
  4. [SOLVED] Union/Range/Cells
    By KentÄ in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-11-2005, 08:06 AM
  5. union problem
    By tom taol in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-01-2005, 05:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1