![]() |
Help with formula
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 |
Help with formula
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 "Stanley Braverman" wrote: 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 |
Help with formula
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 "Stanley Braverman" wrote: 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 |
Help with formula
Thank You Tom,
That worked very well =:) Stanley "Tom Hutchins" wrote in message ... 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 "Stanley Braverman" wrote: 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 |
All times are GMT +1. The time now is 03:33 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com