Excel如何使用ISBLANK

时间:2018-05-10 19:39:47

标签: excel

我的结构如下:

1 
 2
  3
  13
  133
4
 5
  6
7
 8
  9
  19

如何为结构中的每个最后位置和previos结果排成一行?意味着我需要123,下一行1213,下一个12133,456,下一个789,下一个7819?

请帮助!!

1 个答案:

答案 0 :(得分:0)

要添加到我的评论中,我将为您提供符合您要求的VBA代码:

Sub Test()

Dim X As Integer, Y As Integer, Z As Integer

For X = 1 To Range("C" & Rows.Count).End(xlUp).Row
    If Cells(X, 3).Value <> "" Then
        For Y = X To 1 Step -1
            If Cells(Y, 2).Value <> "" Then
                For Z = Y To 1 Step -1
                    If Cells(Z, 1).Value <> "" Then
                        Cells(X, 4).Value = Cells(Z, 1).Value & Cells(Y, 2).Value & Cells(X, 3).Value
                        GoTo ContinueHere
                    End If
                Next Z
            End If
        Next Y
    End If
ContinueHere: Next X

End Sub