step
step

Reputation: 51

Automate to arrange Data

Got any Way to Arrange The data like the picture attached?

*the requirement is when the Column A Cell is empty then Column B Value will Move to previous not Empty Column A Row at Column B Cell.

Example Photo

Upvotes: 0

Views: 28

Answers (1)

Krishna
Krishna

Reputation: 41

Try this code

Sub Macro1()

Dim i As Long
 i = 1
  Do Until Cells(i, 2) = ""
    If Cells(i, 1) = "" Then
    On Error Resume Next
     Cells(i - 1, 2) = Cells(i - 1, 2) & "," & Cells(i, 2)
       Cells(i, 2).EntireRow.Delete
          i = i - 1
        End If
         i = i + 1
        Loop

End Sub

Upvotes: 1

Related Questions