Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
returning back to loop check condition without completing the loop | Excel Programming | |||
Loop to Filter, Name Sheets. If Blank, Exit Loop | Excel Programming | |||
Naming Worksheets - Loop within a loop issue | Excel Programming | |||
Advancing outer Loop Based on criteria of inner loop | Excel Programming | |||
Problem adding charts using Do-Loop Until loop | Excel Programming |