1。判断单元格内容是否有重复(给重复内容填充红色)
2。J4:Q11
3.同列提取单元格内重复的内容到第3单元(第三单元前加“A”字符)
也就是说第三单元=A+填充红色的字符
要用VBA
2ãæåå 容æ¶éå¤çç®ä¸ä¸ªè¿æ¯æå 个æå 个ï¼æ¯å¦J4J5é½æ¯xï¼J3æ¯Axè¿æ¯Axx追é®
AXx
追çsub xxx()
for i=10 to 17
s="A"
for j=4 to 10
if cells(j,i).interior.colorindex3 then
for k=j +1 to 11
if cells(j,i)=cells(k,i) then
if cells(j,i).interior.colorindex3 then
cells(j,i).interior.colorindex=3
s=s & cells(j,i)
endif
cells(k,i).interior.colorindex=3
s=s & cells(k,i)
endif
next
endif
next
if s"A" then
cells(3,i)=s
endif
next
end sub
å¦æä¿®æ¹ä¸ºB17ï¼I24
æåååçå
容å¨15åå
请é®å¦ä½ä¿®æ¹
i=2 to 9
j=17 to 23
k=j to 24
ä¸å¯¹
é¦å
å¤ææ¯ä¸åæ¯ä¸ä¸ªåå
çå符串æ¯å¦æéå¤ï¼å¦ææéå¤ï¼ç»éå¤çå符串æ¶çº¢è²ï¼
ç¶ååå¤ææ¶çº¢è²çå符
B17ï¼I24èå´
æåååçå
容å¨15åå
http://pan.baidu.com/s/1pJHYmwF
excel vbaå¤æåå
æ ¼å
容æ¯å¦æéå¤
Sub Sheet3_按钮1_Click()
Dim i As Integer
Dim j As Integer
Dim Num As Integer
For i = 10 To 17
Cells(3, i) = ""
Cells(3, i).Font.ColorIndex = 3
Next i
For i = 4 To 11
For j = 10 To 17
Num = Evaluate("COUNTIF(J4:Q11," & Cells(i, j) & ")")
If Num > 1 Then
Cells(i, j).Interior.ColorIndex = 3
If Cells(3, j) = "" Then
Cells(3, j) = "A+" & Cells(i, j)
Else
Cells(3, j) = Cells(3, j) & " " & Cells(i, j)
End If
End If
Next j
Next i
End Sub
要用VBA
先填充重复字符为红色
然后再将列红色的字合并到第三单元格