Prevent columns between two highlighted columns from being copied to a text file

Ian Y

New Member
Joined
Nov 18, 2023
Messages
37
Office Version
  1. 2019
Platform
  1. Windows
I need to copy several non-adjacent columns to a text file. The problem is that, columns which are between the highlighted columns are copied to the text file, too.

For example, after I used the Ctrl key and the left mouse click to highlight column A and C, I pressed Ctrl + C to copy them. But when I pasted the copied values into a text file, I saw column B was pasted, too. I don't want column B in that case.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
What happens if you hide column B before copying the other two?
 
Upvote 0
What happens if you hide column B before copying the other two?
That will work. But I would have to unhide it afterwards. There are like 20 ~ 30 Excel files I have to go through every day, so hiding/unhiding unwanted columns is not a productive way.
 
Upvote 0
That will work. But I would have to unhide it afterwards. There are like 20 ~ 30 Excel files I have to go through every day, so hiding columns before copying is not an ideal way.
maybe you have to include the data, so maybe I can make a VBA for that problem
 
Upvote 0
maybe you have to include the data, so maybe I can make a VBA for that problem
My gratitude to you for your offer of help. Because of the private nature of those data, I'm unable to include them here.
 
Upvote 0
maybe you have to include the data, so maybe I can make a VBA for that problem
Surely any dummy data where non-sequential columns are being copied would do to demonstrate such code?

Because of the private nature of those data, I'm unable to include them here.
Surely any dummy data where non-sequential columns are being copied would do?
 
Upvote 0
Surely any dummy data where non-sequential columns are being copied would do to demonstrate such code?


Surely any dummy data where non-sequential columns are being copied would do?
You're right. It's funny that I didn't I think of that.

But I'm not sure how to include my data here, and the structure of my data is also not so special that it needs to be demonstrated. It might be more helpful that I explain my need:

Column A to H are needed, and one or more triplet columns thereafter are needed, too, depending on each day's need. Those triplet columns might or might not be adjacent to column H.

For example, after selecting Column A to H, I also select any of the following:
  • Column I, J, K
  • Column L, M, N
  • Column I, J, K, L, M, N
  • Column L, M, N, O, P, Q
  • Column O, P, Q
  • Column O, P, Q, R, S, T, U, V, W
  • ......(endless possibilities)......
 
Last edited:
Upvote 0
@Peter_SSs, Thanks. My demonstrative mini-sheet is as follows:
Book1
ABCDEFGHIJKLMNOPQRSTUVW
1AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWW
2AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWW
3AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWW
4AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWW
5AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWW
6AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWW
7AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWW
8AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWW
9AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWW
10AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWW
Sheet1
 
Upvote 0
Cheers, at least now @SunnyAlv (or other potential helpers) have something to go on.
Can you confirm that every column has data down to the same final row?
 
Upvote 0

Forum statistics

Threads
1,215,097
Messages
6,123,076
Members
449,094
Latest member
mystic19

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