Remove empty rows and rearrange num column

motilulla

Well-known Member
Joined
Feb 13, 2008
Messages
2,422
Office Version
  1. 2010
Hello,</SPAN></SPAN>

I need to remove empty rows from column C and rearrange Num column B </SPAN></SPAN>

Original Data</SPAN></SPAN>


Book1
ABCDE
1
2
3
4
5SeriolNumData
611K-K-K-K-K-K-K-K-K-K-K-K-K-K
722K-K-K-K-K-K-K-K-K-K-K-K-K-L
833
944K-K-K-K-K-K-K-K-K-K-K-K-L-K
1055K-K-K-K-K-K-K-K-K-K-K-K-L-L
1166
1277K-K-K-K-K-K-K-K-K-K-K-K-25-K
1388
1499K-K-K-K-K-K-K-K-K-K-K-K-25-25
151010
161111
171212
181313K-K-K-K-K-K-K-K-K-K-K-L-L-K
191414
201515
211616K-K-K-K-K-K-K-K-K-K-K-L-25-K
221717
231818
241919
252020K-K-K-K-K-K-K-K-K-K-K-25-K-L
262121K-K-K-K-K-K-K-K-K-K-K-25-K-25
272222K-K-K-K-K-K-K-K-K-K-K-25-L-K
282323K-K-K-K-K-K-K-K-K-K-K-25-L-L
292424
302525
312626K-K-K-K-K-K-K-K-K-K-K-25-25-L
322727K-K-K-K-K-K-K-K-K-K-K-25-25-25
332828
342929
353030
363131
373232
383333
3934
4035
4136
4237
4338
4439
4540
4641
4742
48
49
Data


Required this Result </SPAN></SPAN>


Book1
ABCDE
1
2
3
4
5SeriolNumData
611K-K-K-K-K-K-K-K-K-K-K-K-K-K
722K-K-K-K-K-K-K-K-K-K-K-K-K-L
833K-K-K-K-K-K-K-K-K-K-K-K-L-K
944K-K-K-K-K-K-K-K-K-K-K-K-L-L
1055K-K-K-K-K-K-K-K-K-K-K-K-25-K
1166K-K-K-K-K-K-K-K-K-K-K-K-25-25
1277K-K-K-K-K-K-K-K-K-K-K-L-L-K
1388K-K-K-K-K-K-K-K-K-K-K-L-25-K
1499K-K-K-K-K-K-K-K-K-K-K-25-K-L
151010K-K-K-K-K-K-K-K-K-K-K-25-K-25
161111K-K-K-K-K-K-K-K-K-K-K-25-L-K
171212K-K-K-K-K-K-K-K-K-K-K-25-L-L
181313K-K-K-K-K-K-K-K-K-K-K-25-25-L
191414K-K-K-K-K-K-K-K-K-K-K-25-25-25
2015
2116
2217
2318
2419
2520
2621
2722
2823
2924
3025
3126
3227
3328
3429
3530
3631
3732
3833
3934
4035
4136
4237
4338
4439
4540
4641
4742
48
49
Result


Thank you all</SPAN></SPAN>

Excel 2000</SPAN></SPAN>
Regards,</SPAN>
Moti</SPAN></SPAN>
 
Last edited:

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
In your originala data, put in B6 and fill down

=IF(C6<>"",COUNTA($C$6:C6),"")
 
Last edited:
Upvote 0
Here is a macro that does what I think you want...
Code:
[table="width: 500"]
[tr]
	[td]Sub RemoveBlanksInColumnCandRenumberColumnB()
  On Error Resume Next
  Intersect(Range("C6", Cells(Rows.Count, "B").End(xlUp).Offset(, 1)).SpecialCells(xlBlanks).EntireRow, Columns("B:C")).Delete xlShiftUp
  With Range("B6", Cells(Rows.Count, "C").End(xlUp).Offset(, -1))
    .Value = Evaluate("ROW(1:" & .Rows.Count & ")")
  End With
  On Error GoTo 0
End Sub[/td]
[/tr]
[/table]
 
Upvote 0
Solution
Here is a macro that does what I think you want...
Code:
[TABLE="width: 500"]
<TBODY>[TR]
[TD]Sub RemoveBlanksInColumnCandRenumberColumnB()
  On Error Resume Next
  Intersect(Range("C6", Cells(Rows.Count, "B").End(xlUp).Offset(, 1)).SpecialCells(xlBlanks).EntireRow, Columns("B:C")).Delete xlShiftUp
  With Range("B6", Cells(Rows.Count, "C").End(xlUp).Offset(, -1))
    .Value = Evaluate("ROW(1:" & .Rows.Count & ")")
  End With
  On Error GoTo 0
End Sub
[/TD]
[/TR]
</TBODY>[/TABLE]
Rick, the macro worked great as request</SPAN></SPAN>

I appreciate your kind help
</SPAN></SPAN>

Kind Regards,
</SPAN></SPAN>
Moti
:)</SPAN></SPAN>
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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