VBA: how to reutilise a stored range

Nelson78

Well-known Member
Joined
Sep 11, 2017
Messages
526
Office Version
  1. 2007
Hello everybody.

At the beginning of a macro, I've stored a range in variable rng and then I've deleted it from sheet1.
At the end, I've to "paste" it in another position, starting from row z of column A.

How can I manage this job?


ps. my unsuccessful attempt:

Code:
rng.Insert (sheet1.Cells(z, 1))
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Hi there, do you mind posting more of the code? I'm a bit confused why you would need to copy/store the value at the beginning and wait until the end to paste it back in.
 
Upvote 0
Code:
  Sheet1.Cells(z, 1).Resize(UBound(rng, 1), UBound(rng, 2)).Value2 = rng
 
Upvote 0

Forum statistics

Threads
1,216,322
Messages
6,130,046
Members
449,554
Latest member
andyspa

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
Back
Top