Both Range Addresses get Changed, not just one

jim may

Well-known Member
Joined
Jul 4, 2004
Messages
7,484
When I move the range rDes, another range rOrig with the same address gets changed. How can I prevent this?

Code:
Sub Macro1()
Dim rSrc As Range
Dim rDes As Range
Dim rOrig As Range
Set rOrig = Selection
If rOrig.Count < 2 Or rOrig.Columns.Count <> 1 Then
MsgBox "Re-Check your Selection - It doesn't look right"
Exit Sub
End If
Set rSrc = Selection
    Set sDes = Application.InputBox("Click on Destination Cell", Type:=8)
    rSrc.Cut _
    Destination:=sDes
    rOrig.Select        'Currently this address is the pasted address of rDes -- I need for it to retain it's original address
    rOrig = "0"
End Sub
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Teeroy

Well-known Member
Joined
Nov 9, 2012
Messages
2,244
Office Version
  1. 365
Platform
  1. Windows
One way is instead of setting a Range object (rOrig) set a string (sOrig) with the Address of the cell, then set the Range object after you move rDes (if you need to).
 

Teeroy

Well-known Member
Joined
Nov 9, 2012
Messages
2,244
Office Version
  1. 365
Platform
  1. Windows
You're welcome.
 

Forum statistics

Threads
1,137,301
Messages
5,680,705
Members
419,929
Latest member
Atlas Quinn

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top