Insert Row

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Hi Mohamed

Do you mean if a value in column B is the same as the value immediately below, insert a row between them? If so, try the following

Code:
Sub InsRows()
Dim i, x

x = Worksheets("Sheet3").UsedRange.Rows.Count

For i = x To 2 Step -1

    If Range("B" & i).Value = Range("B" & i).Offset(-1).Value Then
        Range("B" & i).EntireRow.Insert
    End If
Next i

End Sub

If that is not what you want, you will need to explain a little more.
 
Upvote 0
hi steve,

i have data in cell A1, A2, A3, A4, A5, .....[TABLE="width: 150"]
<tbody>[TR]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD="align: center"]Nibras[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD="align: center"]Steve[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD="align: center"]Mohamed[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD="align: center"]Friend[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD="align: center"]Wife[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD="align: center"]Sister[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
then after i need
[TABLE="width: 150"]
<tbody>[TR]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD]Nibras[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Nibras[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Steve[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Steve[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]Mohamed[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]Mohamed[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]Friend[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]11[/TD]
[TD]Friend[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]13[/TD]
[TD]Wife[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]14[/TD]
[TD]Wife[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]15[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]16[/TD]
[TD]Sister[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]17[/TD]
[TD]Sister[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
do you got it
 
Upvote 0
If all of your data are constants (that is, as long as there are no formulas on the sheet), then you can user this macro...
Code:
[table="width: 500"]
[tr]
	[td]Sub DoubleUpAndSeparate()
  Dim R As Long, C As Long, X As Long, Data As Variant, Result As Variant
  Data = Range("A1:E" & Cells(Rows.Count, "A").End(xlUp).Row)
  ReDim Result(1 To 3 * UBound(Data, 1), 1 To UBound(Data, 2))
  X = -2
  For R = 1 To UBound(Data, 1)
    X = X + 3
    For C = 1 To UBound(Data, 2)
      Result(X, C) = Data(R, C)
      Result(X + 1, C) = Data(R, C)
    Next
  Next
  Range("A1").Resize(UBound(Result, 1), UBound(Result, 2)) = Result
End Sub[/td]
[/tr]
[/table]
 
Upvote 0

Forum statistics

Threads
1,223,270
Messages
6,171,102
Members
452,379
Latest member
IainTru

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top