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:

    Columns("F:F").Select

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.
jnash67Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

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

 Range("F:F").EntireColumn.Hidden = True
0
 
origflaCommented:
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:
http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Excel/Q_21913151.html

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

Good luck
0
 
AJKBOCCommented:
jnash67,

  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.

Savvas
0
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
0
 
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.
0
 
jnash67Author Commented:
Solves my problem. Thx.
0
All Courses

From novice to tech pro — start learning today.