Results 1 to 6 of 6

Thread: How to partially merge rows & cells

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2024
    Posts
    13

    How to partially merge rows & cells

    Hi,
    In my mshflexgrid I have - let's say - 4 columns.

    In the last 2 rows of my mshflexgrid, I want to merge rows and columns but only within the first 2 columns.

    For Example, I have last 2 rows of my grid looking like this:
    Name:  Zrzut ekranu 2024-12-03 154950.jpg
Views: 279
Size:  3.4 KB

    And I want them to look like this:
    Name:  Zrzut ekranu 2024-12-03 155022.jpg
Views: 282
Size:  3.2 KB

    Is this possible to achieve without adding some hidden columns etc.? I want all my data above the last 2 rows to have cells not merged.

  2. #2
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    6,733

    Re: How to partially merge rows & cells

    It seems that merging a row and column at the same time give strange effects.
    Also a cell needs to contain data to be merged.

    This was the best I could achieve with some basic tests
    Code:
    Option Explicit
    
    Private Sub Form_Load()
      With MSHFlexGrid1
        .Rows = 4
        .Cols = 4
        .FixedRows = 0
        .FixedCols = 0
        .TextMatrix(0, 2) = "Some Text 1"
        .TextMatrix(0, 3) = "Some Text 2"
        .TextMatrix(0, 0) = " "
        .TextMatrix(0, 1) = " "
        .TextMatrix(1, 0) = " "
        .TextMatrix(1, 1) = " "
        .MergeCells = flexMergeFree
      End With
    End Sub
    
    Private Sub Command1_Click()
      With MSHFlexGrid1
        .MergeRow(0) = True
        .MergeRow(1) = True
      End With
    End Sub
    
    Private Sub Command2_Click()
      With MSHFlexGrid1
        .MergeCol(0) = True
        .MergeCol(1) = True
      End With
    End Sub

  3. #3
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: How to partially merge rows & cells

    VBFlexGrid MergeCells can span multiple rows and columns together.

  4. #4

    Thread Starter
    New Member
    Join Date
    Nov 2024
    Posts
    13

    Re: How to partially merge rows & cells

    I am unable to find an example online that will show how to use MergeCells property to combine cells with the same value in both rows and columns at the same time. It is either merging cells in a row or in a column...

  5. #5
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    6,733

    Re: How to partially merge rows & cells

    The MS(H)FlexGrid is not capable of doing this.
    It's either in the column or in the row, not both.
    Check the vbFlexGrid by Kr00l: https://www.vbforums.com/showthread....xGrid-control)

  6. #6

    Thread Starter
    New Member
    Join Date
    Nov 2024
    Posts
    13

    Re: How to partially merge rows & cells

    Thank you. I was looking for a confirmation.

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width