VBAで良ければ。少数例でテスト済み。
Sub test01()
Dim sh1 As Worksheet
Dim p As Integer
Dim s As Integer
s = InputBox("チェックする列")
p = InputBox("空きの列=")
Set sh1 = Worksheets("sheet1")
'----------チェックする列を空き列にコピー
sh1.Activate
d = sh1.Range("a1").CurrentRegion.Rows.Count
sh1.Range(Cells(2, s), Cells(d, s)).Copy
sh1.Activate
sh1.Cells(2, p).Select
ActiveSheet.Paste
'-----------チェックする列の行番号保存
For i = 2 To d
sh1.Cells(i, p + 1) = i
Next i
'-----------ソート
Range(Cells(2, p), Cells(d, p + 1)).Select
Selection.Sort Key1:=Cells(2, p), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, SortMethod _
:=xlPinYin
'--------重複チェック
For i = 2 To d
If Cells(i, p) = Cells(i + 1, p) Then
x = Cells(i, p + 1)
Cells(x, s).Interior.ColorIndex = 6
y = Cells(i + 1, p + 1)
Cells(y, s).Interior.ColorIndex = 6
End If
Next i
End Sub
-----------
(テストデータ)Sheet1にA1:A13に
コード、a、b、a、c、d、e、d、f、g、f、a、hと入れる。
(プログラム)
シートでALT+F11-->VBE画面
ALT+I(挿入)、ALT+M(標準モジュール)
上記コピー。
F5キー(実行)
s = InputBox("チェックする列")
p = InputBox("空きの列=")を聞いてきますから
はじめの問いにはA列なら1、次はd列なら4と入れてください。
重複行には、A列に色がつきます。
D,D+1列2列余分に使いますが消しておいてください。
VBAでも簡単ですが手抜き略。
お礼
どうもありがとうございました。 countif関数、大変参考になりました。 他の方たちもご回答ありがとうございました。 でも、VBAは全くわからなかったので今後、勉強したいと思います。