Quantcast
Channel: OKWAVE 最新質問(Visual Basic/257)【本日】
Viewing all articles
Browse latest Browse all 6510

重複行削除のマクロ

$
0
0
重複行を削除するマクロを作っていますが、うまくいきません。 2行目にタイトルが入っていて、3行目以降が必要なデータになります。 この中でA列が一致しているデータ行を削除したいと考えており、 重複データが削除された後、タイトル行がなぜか一番下の行にはりついてしまいます。 どなたか詳しい方助けてください!!!よろしくお願いします。 ちなみに以下が現在使用しているVBAコードです。 =============================================================== Sub GoodRemoveDuplicates() 'A列にデータが入力されており、そのデータを並べ替えた後、 '重複するデータが含まれている行を削除するマクロ Worksheets("貼り付け用用マクロ").Range("A1").Sort _ key1:=Worksheets("貼り付け用用マクロ").Range("A1") Set currentCell = Worksheets("貼り付け用用マクロ").Range("A1") Do While Not IsEmpty(currentCell) Set nextCell = currentCell.Offset(1, 0) If nextCell.Value = currentCell.Value Then currentCell.EntireRow.Delete End If Set currentCell = nextCell Loop End Sub ===============================================================

Viewing all articles
Browse latest Browse all 6510

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>