+ Reply to Thread
Results 1 to 3 of 3

Swap Two Cell Ranges?

Hybrid View

papagorgio Swap Two Cell Ranges? 10-26-2010, 01:32 PM
Paul Re: Swap Two Cell Ranges? 10-26-2010, 01:35 PM
papagorgio Re: Swap Two Cell Ranges? 10-26-2010, 01:46 PM
  1. #1
    Registered User
    Join Date
    08-26-2009
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2003
    Posts
    25

    Swap Two Cell Ranges?

    Hi,

    Im trying to swap the contents of "B554:W554" with "B555:W555"

    I've search but I'm only able to find macro's that swap individual cells.

    Anyone know how I can do this?

    I've found this macro that swaps entire rows however I require column A to be fixed.
    Dim tempRRay As Variant
    Range("B554:W555").Select
    With Selection
       With Range(.Areas(1), .Areas(.Areas.count)).EntireRow
          tempRRay = .Rows(1).Value
          .Rows(1).Value = .Rows(.Rows.count).Value
          .Rows(.Rows.count).Value = tempRRay
       End With
    End With
    Thanks in advance!

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: Swap Two Cell Ranges?

    Hi Papa, perhaps something as simple as this will work?
    Sub switchrows()
    Dim arr1, arr2
    arr1 = Range("B554:W554").Value
    arr2 = Range("B555:W555").Value
    Range("B554:W554").Value = arr2
    Range("B555:W555").Value = arr1
    End Sub

  3. #3
    Registered User
    Join Date
    08-26-2009
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2003
    Posts
    25

    Re: Swap Two Cell Ranges?

    Wow, that worked perfectly. Excellent. Thanks!!
    Last edited by Paul; 10-26-2010 at 01:50 PM. Reason: Removed quote of full post

+ 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