+ Reply to Thread
Results 1 to 3 of 3

Referencing multiple ranges of a varying row

  1. #1
    Registered User
    Join Date
    07-20-2017
    Location
    CANADA
    MS-Off Ver
    2016
    Posts
    2

    Question Referencing multiple ranges of a varying row

    I've written a code in VB to sort through a main sheet and copy certain rows over to other sheets. I'm incrementing the sort with a variable i and for the one sheet, I don't want to copy the entire row. I wish for it to copy all except one column but can't seem to figure out the proper syntax. Please help.

    The part of my code in question is:

    For i = 10 To LastRow

    If Sheets("Main").Range("C" & i).Value Like "*D*I*A*" Then
    Sheets("Main").Cells(i, "C").EntireRow.Copy Destination:=Sheets("ROUND STOCK").Range("A" & Rows.Count).End(xlUp).Offset(1)

    "EntireRow" is where I would like to place my ranges. Any ideas would help.

    Thank you in advance!

  2. #2
    Forum Expert
    Join Date
    06-26-2010
    Location
    Austin, TX
    MS-Off Ver
    Excel 2010
    Posts
    1,673

    Re: Referencing multiple ranges of a varying row

    I would recommend you just break the copy into the 'left' and 'right' data of the column you wish to exclude. So, something like:
    Please Login or Register  to view this content.
    That should copy data from columns A to D and F to G to the next sheet.

    If you want to keep it all one line, you could use the application.union(Range(...), Range(...)) to combine ranges.
    Pauley
    --------
    If I helped with your issue, I'd appreciate a rep bump (hit the '*' icon to the bottom left of this post).

  3. #3
    Registered User
    Join Date
    07-20-2017
    Location
    CANADA
    MS-Off Ver
    2016
    Posts
    2

    Re: Referencing multiple ranges of a varying row

    Thank you very much, I found an alternative solution in the meantime but that's definitely good to know for the future

+ 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. Replies: 21
    Last Post: 03-16-2017, 12:51 PM
  2. Transpose Multiple (& Varying) Rows into Multiple (& Varying) Columns
    By Andrea9578 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-05-2017, 11:46 AM
  3. Transpose Multiple (& Varying) Rows into Multiple (& Varying) Columns
    By Andrea9578 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-05-2017, 02:05 AM
  4. Referencing cells in varying positions
    By chilli76 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-02-2014, 03:51 PM
  5. [SOLVED] Syntax for referencing multiple ranges when using copy & paste feature
    By moosetales in forum Excel Programming / VBA / Macros
    Replies: 95
    Last Post: 05-16-2014, 08:52 AM
  6. Referencing multiple ranges to return a value
    By michaelhill525 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-11-2013, 10:27 AM
  7. How to sum rows of varying ranges?
    By lbroxterman in forum Excel General
    Replies: 9
    Last Post: 07-25-2012, 10:28 PM

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