发布网友 发布时间:2022-02-26 04:39
共2个回答
热心网友 时间:2022-02-26 06:41
用index与match两个函数组合,函数具体的用法可在网上寻找或是找帮助文件。实现你说的功能不一定要用VB才能实现
热心网友 时间:2022-02-26 08:33
嗯,是的,需要用VB追问能帮忙做一个吗?
追答
Alt+F11 双击左侧栏”ThisWorkbook“,在右侧打开窗口粘贴正面代码,
Sub 求和筛选()
Dim i As Integer, j As Integer, m As Integer, n As Integer, k As Integer, a As Integer
a = 32
k = Range("g6")
For i = 1 To 5
For j = 1 To 5
For m = 1 To 5
For n = 1 To 5
If Cells(i, j) + Cells(m, n) = k Then
If i <> m Or j <> n Then
Cells(i, j).Interior.ColorIndex = a
Cells(m, n).Interior.ColorIndex = a
a = a + 1
End If
End If
Next n
Next m
Next j
Next i
End Sub
正文如图(目标单元格为G6)