excel中:在N行N列数据中,如何用涵数查找相同位置的两(或N)个数字?谢谢!如下图

 我来答
艾特七七号
2012-03-15 · TA获得超过110个赞
知道小有建树答主
回答量:251
采纳率:0%
帮助的人:137万
展开全部
你是说在这些数据中找到有两个(或多个)相同位置数字相同的单元格,并标记为黄颜色,用vba可轻松实现
Sub Mac1()
Dim nRow As Integer
Dim nCol As Integer
Dim tmpRow As Integer
Dim tmpCol As Integer
Dim tmpTmpRow As Integer
Dim nBook As Workbook
Dim n As Integer
Dim tmpn As Integer
Dim myArray() As Integer
Set nBook = ThisWorkbook
nRow = nBook.Sheets(1).UsedRange.Rows.Count
nCol = nBook.Sheets(1).UsedRange.Columns.Count
ReDim myArray(nCol)
For tmpRow = 1 To nRow - 1
For tmpTmpRow = tmpRow + 1 To nRow
n = 0
For tmpCol = 1 To nCol
If Cells(tmpTmpRow, tmpCol) = Cells(tmpRow, tmpCol) Then
myArray(n) = tmpCol
n = n + 1
End If
Next
If n >= 2 Then
For tmpn = 0 To n - 1
Cells(tmpRow, myArray(tmpn)).Interior.ColorIndex = 6
Cells(tmpTmpRow, myArray(tmpn)).Interior.ColorIndex = 6
Next
End If
Next
Next
End Sub
论坛砖家
2012-03-12 · TA获得超过676个赞
知道小有建树答主
回答量:647
采纳率:83%
帮助的人:246万
展开全部
用countif()函数,具体用法网上有,不再啰嗦
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
e2692c
2012-03-10 · 超过32用户采纳过TA的回答
知道答主
回答量:93
采纳率:100%
帮助的人:60.4万
展开全部
什么叫相同位置?还有你这个是6行5列
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式