VBA Column ().Select

Arie Bos

Board Regular
Joined
Mar 25, 2016
Messages
224
Office Version
  1. 365
Platform
  1. Windows
I have data in columns A - K
to clean column A, I use:
Columns("A:A").Select
Selection.ClearContents

this works fine, next step is to do something in column B, so I use
Columns("B:B").Select
.....

But now all columns with data are selected, not just column B. Same happened for Columns("H:J").Select or any other selection


Why is this happening?
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
At a guess, you have merged cells.
 
Upvote 0
At a guess, you have merged cells.

I think that's more than a guess! :biggrin:

(Not sure which version this first appeared in, or which you have, but) if you don't want to lose the formatting of any merged cells, unmerge them, right click the same selection of cells that were merged, and on the alignment tab, in the Horizontal there is 'Center across selection'.

It won't behave in any way like a merged cell, but it will still look like one for presentation.
 
Upvote 0

Forum statistics

Threads
1,224,825
Messages
6,181,190
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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