-1

Excelスプレッドシートでデータの要約を作成しようとしています。最初の列に基づいて最後の一意の行をコピーしたい データの例を次に示します。

DocOrd#   text    Value

1         text    .1
1         text    .2
1         text    .3
1         text    .4
2         text     2
2         text     4
2         text     6
2         text     8
3         text     1
3         text     2
3         text     3
3         text     4

私が欲しいもの:

DocOrd#   text    Value

1         text    .4
2         text     8 
3         text     4

助けてくれてありがとう

4

1 に答える 1

0

これは役立つかもしれません-データをループし(Sheet1セルで開始すると仮定A1)、それぞれの最後のエントリを取得してDocOrd#配置しますSheet2

Sub CopyLastEntry()
    Dim entries As Range, entry As Range, cnt As Long

    Set entries = Range("A2:A" & Range("A1").End(xlDown).Row) //Change as per your s/sheet
    cnt = 1

    For Each entry In entries
        If entry <> entry.Offset(1, 0) Then
            Range(entry, entry.Offset(0, 3)).Copy Destination:=Worksheets(2).Range("A" & cnt)
            cnt = cnt + 1
        End If
    Next entry
End Sub
于 2013-10-08T20:36:26.520 に答える