VBA: Simple Array

mqarep

Board Regular
Joined
Mar 12, 2002
Messages
91
I have a worksheet where a user clicks on a button and a macro runs which adjust a 12 month range of data to incorporate the new month. I have an undo button that returns the month range and associated data back to its state before the adjust range button was first clicked.

What I want to do is to accomplish this using an array.
This is what would need to happen:

Macro button 1:
Cells c20 through c34 need to be read into an array.

Macro button 2:
This array then needs to be read and the contents restored to cells c20 through c34.

How can I accomplish this?

Thanks.
 
Yes, I agree. Anyone who wants to read a range into an array and put it back is really doing nothing more than make-busy work. Just don't use the same words when you tell the person who told you to do it.
What a jackass...
 
Upvote 0

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Tushar:
I believe the OP just wants the data in the array so it can be used in an 'undo'
type action after changes have been made to the original data in that range.


mqarep:
Where do I insert "Public myVariant As Variant" and what code, if any, does it replace?
This line would go into any standard module and replaces the line in your
sub adjustrange():
Dim myVariant As Variant

Also, (if I may suggest), you might want to give some serious thought before making
remarks such as that about the likes of tusharm (or anyone here for that matter when
you're the one asking for help).
tusharm happens to be one of the very best there is (anywhere) and is likely a
source you really don't want to be ignored by when something really, really
difficult comes up. :wink:
 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,917
Members
449,093
Latest member
dbomb1414

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