Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Esrei
 
Posts: n/a
Default Macro that inserts lines

I have this macro that inserts a line if the value in D changes and copy the
value in D to A. I want this macro to only start looking in D14 or from row
14.

tx for all the help


Dim row_index As Long
Application.ScreenUpdating = False
lastrow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).row
For row_index = lastrow - 1 To 2 Step -1
If Cells(row_index, "D").Value < _
Cells(row_index + 1, "D").Value Then
Cells(row_index + 1, "D").EntireRow.Insert _
(xlShiftDown)
Cells(row_index + 1, 1).Value = Cells(row_index + 2, 4).Value
End If
Next
End Sub
  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

Is it not working then? If so, how?

--
HTH

Bob Phillips

"Esrei" wrote in message
...
I have this macro that inserts a line if the value in D changes and copy

the
value in D to A. I want this macro to only start looking in D14 or from

row
14.

tx for all the help


Dim row_index As Long
Application.ScreenUpdating = False
lastrow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).row
For row_index = lastrow - 1 To 2 Step -1
If Cells(row_index, "D").Value < _
Cells(row_index + 1, "D").Value Then
Cells(row_index + 1, "D").EntireRow.Insert _
(xlShiftDown)
Cells(row_index + 1, 1).Value = Cells(row_index + 2, 4).Value
End If
Next
End Sub



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro won't run macro dave glynn Excel Discussion (Misc queries) 0 May 3rd 05 04:13 PM
soft-coding lines in a macro GJR3599 Excel Discussion (Misc queries) 1 March 30th 05 10:28 PM
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM
Date macro Hiking Excel Discussion (Misc queries) 9 February 3rd 05 12:40 AM
Macro and If Statement SATB Excel Discussion (Misc queries) 2 December 3rd 04 04:46 PM


All times are GMT +1. The time now is 07:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"