PDA

View Full Version : Solved: Insert blank row below set value



Nader
07-11-2008, 05:38 AM
I want a code :


Cut all the cells of columns A,B,C,D where the value of the column B =< 1000 and past them immediately to the row below. as it show in the pic.

And thak you for help.

Bob Phillips
07-11-2008, 05:53 AM
Dim LastRow As Long

With Activesheet

LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = LastRow To 1 Step -1

If .Cells(i, "B").Value <= 1000 Then

.Rows(i + 1).Insert
End If
Next i
End With

Nader
07-11-2008, 06:22 AM
It's didn't work as I told. it cut the cells from the 1000,but where it past, it creat rows between each cells.
Here is the project.

thank you for your effort.

Bob Phillips
07-11-2008, 06:45 AM
Dim LastRow As Long

With ActiveSheet

LastRow = .Cells(.Rows.Count, "C").End(xlUp).Row
For i = LastRow To 1 Step -1

If .Cells(i, "D").Value > 1000 Then

.Rows(i + 1).Insert
Exit For
End If
Next i
End With

Nader
07-11-2008, 03:37 PM
You always do well.
Thank you for your help!

mdmackillop
07-12-2008, 06:28 AM
Solved?

Aussiebear
07-12-2008, 05:02 PM
Would appear so, given that the requirement was just to insert a blank row after the row containing a predetermined value "=< 1000".

Nader, the difficulty here with this post is that your description of what you would like done and that which was required to be done was somewhat different. XLD has done a wonderful job in decifering your request.

Can I therefore take a moment to comment on a couple of points that you might take into consideration before you make another thread.

Title. When constructing a thread, a meaningful title is of importance. The current title "Can you help to create this code?" does not reflect the issue you are posting about.

Issue. There are clearly times when attaching the workbook or a sample workbook will be of great assistance to those who you are asking for help from. This would appear to be one of those situations, given that your description was somewhat misleading.

Closure. When an issue has been solved, please take the time to mark the thread as "Solved" by using the "Mark this thread solved" option from the Thread Tools at the top of the page.

If there's something here that you believe is difficult to understand, please Message me and I'll be happy to go into further detail with you.

Thank you for your participation in this forum.