Or:
Sub M_snb() sn = Sheet1.Columns(1).SpecialCells(2) With Sheets.Add(, Sheets(Sheets.Count), , "J:\download\hbc9-27-10-10_Out.csv") For j = 1 To UBound(sn) .Columns(3).Replace sn(j, 1), "", 2 Next .Columns(3).SpecialCells(4).EntireRow.Delete .Cells(1).Resize(, 12) = [transpose(char(row(65:77)))] .Cells(1, 16).Resize(2) = Application.Transpose(Array(.Cells(1, 7), "C")) .Cells(1).CurrentRegion.AdvancedFilter 2, .Cells(1, 16).CurrentRegion, .Cells(1, 20) sn = .Cells(1, 20).CurrentRegion.Offset(1) .Cells(1, 16).CurrentRegion.ClearContents .Cells(1, 20).CurrentRegion.ClearContents For j = 1 To UBound(sn) - 1 If j > 1 Then If sn(j, 1) & sn(j, 3) = sn(j - 1, 1) & sn(j - 1, 3) Then sn(j, 12) = sn(j - 1, 12) sn(j, 2) = "9" & sn(j, 2) Next .Columns(7).Replace "C", "" .Columns(7).SpecialCells(4).EntireRow.Delete .Cells(Rows.Count, 1).End(xlUp).Offset(1).Resize(UBound(sn), UBound(sn, 2)) = sn .Rows(1).ClearContents End With End Sub





Reply With Quote