+ Reply to Thread
Results 1 to 9 of 9

Range copy problem

  1. #1
    Forum Contributor
    Join Date
    11-17-2004
    MS-Off Ver
    Office 2016
    Posts
    527

    Range copy problem

    I have a worksheet where I would like to copy a non-contiguous range of cells to another column, then copy another range back into the first range. The range has some restrictions where certain cells in the range cannot be copied over (these would be calculated fields), and I only want to copy the values, not the cell formats.

    I was hoping to set the range to a non-contiguous range of cells and then use "rng3.Value = rng1.Value" but apparently you can't copy non-contiguous ranges...at least not like this.

    I have attached an example worksheet if someone could show me how to obtain the example result in the worksheet.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Range copy problem

    hi JimDandy, option

    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Range copy problem

    or
    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Range copy problem

    Please Login or Register  to view this content.
    See attached
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    11-17-2004
    MS-Off Ver
    Office 2016
    Posts
    527

    Re: Range copy problem

    Wow, that attachment was really close however the skipped cells will also have numbers in them. I only meant to show that I needed to skip them.

  6. #6
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Range copy problem

    if A4 and A6 are formulas and the rest are numbers:

    Please Login or Register  to view this content.
    If not please post exact data and colour cells to skip and how to define them

  7. #7
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Range copy problem

    How many cells do you intend to skip?
    If it is just 2, then this would work but if there are a lot of cells to be skipped it will be a different story.

    Please Login or Register  to view this content.
    No doubt someone will come with a better solution (put the cells to be skipped in an array maybe)

  8. #8
    Forum Contributor
    Join Date
    11-17-2004
    MS-Off Ver
    Office 2016
    Posts
    527

    Re: Range copy problem

    Yes, that did it...thanks

    I also found this solution

    With Range("C1:C3,C5,C7:C8")
    .FormulaR1C1 = "=RC[-2]"
    For Each Ar In .Areas
    Ar.Value = Ar.Value
    Next
    End With

  9. #9
    Forum Contributor
    Join Date
    11-17-2004
    MS-Off Ver
    Office 2016
    Posts
    527

    Re: Range copy problem

    Here is the attachment with both solutions should anyone want to experiment.

    Thanks to everyone that helped...
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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