
Originally Posted by
rockstar
sorry about the confusion. You assume correctly. I have attached a sample datasheet.
OK - create a macro, and set the code as
Sub SetLines()
Dim iRow As Long, iLastRow As Long, iColumn As Long
iLastRow = ActiveSheet.Range("A65536").End(xlUp).Row
For iRow = iLastRow To 2 Step -1
For iColumn = 3 To 6
If Not Cells(iRow, iColumn).Value = "" Then
Rows(iRow + 1).EntireRow.Insert
Cells(iRow + 1, 1).Value = Cells(iRow, iColumn).Value
Cells(iRow + 1, 2).Value = Cells(iRow, iColumn + 4).Value
End If
Next
Next
End Sub
you could then set the macro options to allow a Shortcut key (say CTRL/Shift/S) and run the macro by pressing ctrl/shift/s.
The macro does not check the sheet name, be carefull of destroying other sheets. The macro is not fully tested, try it out AFTER saving a copy of your data.
The macro does not clear the cells from which the data came, you may want to add
Cells(iRow, iColumn).Value = ""
Cells(iRow, iColumn + 4).Value = ""
immediately before the EndIf
hth
---
added
you might prefer to use
For iColumn = 6 To 3 Step -1
to sequence correctly.
---
Bookmarks