The comma separated value VBA branch of a

Sub test1 ()
    Dim H
    Dim J of As Integer
    J = 0
    Dim N1 of As Integer 'Branches cells in the first columns
    Dim m1 As Integer' filled column
    Dim p As Integer 'number of columns of all contents
    N1 =. 1
    M1 = 2
    . 4 = P
    'the Application.ScreenUpdating = False
    ' = I. 1 the For the to the Range ( "a65536"). End (xlUp) .Row
    the For I = 2 the to 16 'if not completely filled, to increase the number of rows where
        ' MsgBox I
        I I + J =
        H = Split (Cells (I, N1), ",")
        'MsgBox I
        ' MsgBox the UBound (H)
        the If the UBound (H)> 0 the Then
          the Rows (I +. 1) .Resize (the UBound (H)) .insert
          Cells (I, M1) .Resize (the UBound (H) +. 1,. 1) = Application.Transpose (H)
          the UBound = J (H)
          'MsgBox the UBound (H)
          the For the To NUM = J. 1
             the For the To column. 1 = P' cycle in order to control the number of columns of this paste values, the number of column values will need to copy number, where the split is filled column value, if the processing in the inner layer, not fill down
             the if = M1 column the Then
               Cells (I, column) = Cells (I, column)
             Else
               Cells (NUM + I, column) = Cells (I, column)
             the If End
             the Next
          the Next
        Else
           Cells (I, M1) = Application.Transpose (H)
           J = 0
        End the If
        
           
        'the If I <2 the Then
           ' the UBound J = (H)
           'MsgBox "right"
        ' Else
           'the UBound J = (H)
        'End If
    Next
    'Application.ScreenUpdating = True
    
   
End Sub

Guess you like

Origin www.cnblogs.com/xwenwu/p/12022164.html