Move data to the top and leave empty if no data
<p>I have a flexgrid in VB6 that has data in Column 1 and Column 2 it is already populated based on my others code. How ever I have a code that insert a data in column 3 and this is my code.</p>

<pre><code>Dim objDoc      As MSXML2.DOMDocument
    Dim objNodeList As IXMLDOMNodeList
    Dim objNode     As IXMLDOMNode
    Dim rowscount1  As Integer
    Dim rowcount    As Integer

    Set objDoc = New MSXML2.DOMDocument
    objDoc.async = False
    objDoc.Load App.Path &amp; "\Extracted File\" &amp; Text2.Text &amp; "\content.xml"

    'Return all the segment elements
    Set objNodeList = objDoc.selectNodes("//draw:image")

    'loop through the segment elements and pull what you need

    flex.Cols = flex.Cols + 1

    For Each objNode In objNodeList
        Debug.Print objNode.Attributes.getNamedItem("xlink:href").Text

        With flex

             .Rows = .Rows + 1
              .TextMatrix(.Rows - 1, .ColIndex("3")) = Mid(objNode.Attributes.getNamedItem("xlink:href").Text, 10, Len(objNode.Attributes.getNamedItem("xlink:href").Text))

        End With

    Next objNode
rowscount1 = 0
    Set objNode = Nothing
    Set objNodeList = Nothing
    Set objDoc = Nothing
</code></pre>

<p>but the output is this.</p>

<p><a href="https://i.stack.imgur.com/LDQuL.png" rel="nofollow noreferrer">Screenshot of the output</a></p>

<p>supposed to be all datas are together but what happens here is that the program created a row.</p>

<p>How can I fix this? Move data to the top and leave empty if no data.</p>