Excel VBA - select just a particular column when some cell in the column is part of a merged cells range

When I select with Macro Recorder, it properly selects the column and returns code like:


However, when I run this in a subroutine, it ends up selecting a much larger area encompassing every column in a merged cells range (F8:K8 are merged).

How can I get the behavior I get when I do it manually in Excel.
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

Jorge PaulinoConnect With a Mentor IT Pro/DeveloperCommented:
But you can hide without select.

 Range("F:F").EntireColumn.Hidden = True
Sorry to be the bearer of bad news, but it seems, from all my researching that there is no noce way around this one.
The only slution people have come up with is unmerging the cells then re-merging them again once you've selected them.

Have a look at the following thread:

Hope this helps (somewhat) or maybe some guru out there has a solution that hasn't been posted yet.

Good luck

  i am sorry, but i agree with origfla. I tried every possible method but none seems to be working.  You will have to go into unmerging and remerging the cells to do what u want.

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Jorge PaulinoIT Pro/DeveloperCommented:
Agree with all comments above, but why do you need to select the row ?

You can do everything without select it, like:

Range("F:F").Font.Bold = True
jnash67Author Commented:
I have a big report with groupings.  I am printing a custom report by hiding all the extraneous columns.  I am trying to automate the hiding of some columns and then the unhiding.
jnash67Author Commented:
Solves my problem. Thx.
All Courses

From novice to tech pro — start learning today.