![]() |
loop
how to make loop (macro),
raw 13035 13031 13035 13037 13036 13056 13037 13251 13037 13298 13037 13299 13044 13282 13075 13275 13048 13031 13048 13055 13099 13066 13099 13077 13099 13252 13099 13692 result 13035 13037 13031 13036 13056 13037 13299 13298 13251 13044 13282 13075 13275 13048 13055 13031 13099 13692 13252 13077 13066 |
loop
Try this one.
I supposed that data is column A and B and start at row 1. the result will be in the new sheet after activesheet. Sub movedatatest() Dim acsh As Worksheet, dstsh As Worksheet Dim i As Long, j As Long Set acsh = ActiveSheet Set dstsh = Worksheets.Add(after:=acsh) acsh.Select lastrow = Range("A1").End(xlDown).Row j = 1 i = 1 dstsh.Cells(j, "A") = Cells(i, "A") dstsh.Cells(j, "B") = Cells(i, "B") For i = 2 To lastrow If Cells(i, "A") = dstsh.Cells(j, "A") Then Cells(i, "B").Copy dstsh.Cells(j, "B").Insert Shift:=xlToRight Else j = j + 1 dstsh.Cells(j, "A") = Cells(i, "A") dstsh.Cells(j, "B") = Cells(i, "B") End If Next Application.CutCopyMode = False End Sub keiji Skipper wrote: how to make loop (macro), raw 13035 13031 13035 13037 13036 13056 13037 13251 13037 13298 13037 13299 13044 13282 13075 13275 13048 13031 13048 13055 13099 13066 13099 13077 13099 13252 13099 13692 result 13035 13037 13031 13036 13056 13037 13299 13298 13251 13044 13282 13075 13275 13048 13055 13031 13099 13692 13252 13077 13066 |
All times are GMT +1. The time now is 05:33 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com