sorry about the confusion. You assume correctly. I have attached a sample datasheet.
sorry about the confusion. You assume correctly. I have attached a sample datasheet.
OK - create a macro, and set the code asOriginally Posted by rockstar
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.![]()
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
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
immediately before the EndIf![]()
Cells(iRow, iColumn).Value = "" Cells(iRow, iColumn + 4).Value = ""
hth
---
added
you might prefer to use
For iColumn = 6 To 3 Step -1
to sequence correctly.
---
Last edited by Bryan Hessey; 07-07-2007 at 02:08 AM.
Si fractum non sit, noli id reficere.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks