Can I merge (cells) and align center (vertical and horizontal) headings in MSFlexGrid?

Posted on 2005-05-16
Last Modified: 2013-12-25
Could anybody show me how to merge several cells and align center headings horizontally or vertically in MSFlexGrid?


Question by:sabas
    LVL 44

    Accepted Solution

    Hi sabas,

    This shows how to achieve this in a very simple way, you just need a flexgrid with a few rows and columns:

    Private Sub Form_Load()
        With MSFlexGrid1
            .MergeCells = flexMergeFree
            .FormatString = "|^Header 1|^Header 2|^Header 3|^Header 3|Header 4|^Header 5|^Header 6|^Header 7|^Header 8|^Header 9"
            .TextMatrix(1, 1) = "Hello"
            .TextMatrix(2, 1) = "Hello"
            .TextMatrix(1, 3) = "Goodbye"
            .TextMatrix(1, 4) = "Goodbye"
            .MergeCol(1) = True
            .MergeRow(1) = True
            .MergeRow(0) = True
        End With
    End Sub

    Tim Cottee

    Author Comment

    thanks, Tim Cottee

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Introduction In a recent article ( for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
    If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now