Help with formula

S

Stanley Braverman

This code was submitted by SeanC. What this code does is copy the contents
of row A and inserts a row above cells that contains data AND copies
complete row to inserted row and deletes data from original row.
This code counts from last row to first and thats ok.
However this is what I need.
Example of what I need:
Column A B C D
time for A Break original row

New inserted row:
Column A B C D
time inserted row
for A Break original row

Public Sub Temp()
Dim lngRowCount As Long
For lngRowCount = Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1
If Not IsEmpty(Cells(lngRowCount, 1)) Then
Rows(lngRowCount + 1).EntireRow.Insert shift:=xlDown
End If
Next
End Sub

How can I modify this code


Thanks
 
T

Tom Hutchins

Try

Public Sub Temp()
Dim lngRowCount As Long
For lngRowCount = Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1
If Not IsEmpty(Cells(lngRowCount, 1)) Then
Rows(lngRowCount).EntireRow.Insert Shift:=xlDown
Cells(lngRowCount + 1, 1).Cut
Cells(lngRowCount, 1).Select
ActiveSheet.Paste
End If
Next
End Sub

Hope this helps,

Hutch
 
T

Tom Hutchins

Try

Public Sub Temp()
Dim lngRowCount As Long
For lngRowCount = Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1
If Not IsEmpty(Cells(lngRowCount, 1)) Then
Rows(lngRowCount).EntireRow.Insert Shift:=xlDown
Cells(lngRowCount + 1, 1).Cut
Cells(lngRowCount, 1).Select
ActiveSheet.Paste
End If
Next
End Sub

Hope this helps,

Hutch
 
Top