Help with Swapping column - VBA

AlexanderBB

Well-known Member
Joined
Jul 1, 2009
Messages
2,114
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
I've recorded a macro, but I'd like to swap the contents of 2 columns without
having the selection show on screen. (The sheet is displayed in a multi column list box and is not 'active').

I do have the number of rows in a variable.

My thinking is to select each column as a range then swap one for another but I'm not sure how to go about it, or if I'll need to store one column temporarily.

Any help much appreciated, thanks !
 
Hi Rick,

I see what you mean ! :confused:

I found that bit of code after Googling some time ago ... and it did what I wanted so used it. Never realised there was already one... and yes I can see it now. Feel a bit stupid, but too bad! I suppose there's some good reason I got no 'ambigueous name' error...

Cheers, ABB
 
Upvote 0

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Forum statistics

Threads
1,225,072
Messages
6,182,699
Members
453,132
Latest member
nsnodgrass73

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