+ Reply to Thread
Results 1 to 2 of 2

Excel macro vba - hide specific colums doesnt work due to merged cell

Hybrid View

  1. #1
    Registered User
    Join Date
    12-21-2012
    Location
    netherlands
    MS-Off Ver
    Excel 2007
    Posts
    2

    Excel macro vba - hide specific colums doesnt work due to merged cell

    Hi Everyone,

    I am working now with building a macro for generating a standard hours report, in a worksheet i want to hide a specific period(month) columns, i have in total 12 columns for months, above the row i have a merged cell called "The HOURS" in the range from period 1 to 12, but when i want to hide for example column "period 3 and period 4" with VBA code, it hides all the 12 the colunms due this merged cell.

    Which VBA code do i have to use so that only the specified columns should be hide. I dont want to change the merged cell to normal cell.

    I used the following VBA code for example


    Columns("S:T").Select
    Selection.EntireColumn.Hidden = True


    I would be pleased if you could help me with this.

    Kind Regards,
    kilaz17

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Excel macro vba - hide specific colums doesnt work due to merged cell

    Merged cells and VBA do not play well together. I know this isn't very helpfull. Try thinking about the layout of your sheet and see if there is another way that you can organize it. Maybe rather than hiding the columns you could change the text color to white (not nearly as effective but would technically work). Some of the more advanced people might have some better options.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1