Function abc(a As Range, b As Range, c As String) Dim t As String \'如果a与b的区域大小不同,就显示“错误” If a.Rows.Count <> b.Rows.Count Then abc = "错误": Exit Function \'在区域a是循环 For i = 1 To a.Rows.Count \'如果在a中找到与c相同的值,就把同一行中的b的内容提取出来,存入变量t中。 If a.Cells(i, 1) = c Then t = t & " " & b.Cells(i, 1) Next \'将变量的值赋给自定义函数 abc = t End Function
XY
追问
2022-01-14 11:42
Function abc(a As Range, b As Range, c As String) Dim t As String \'如果a与b的区域大小不同,就显示“错误” If a.Rows.Count <> b.Rows.Count Then abc = "错误": Exit Function \'在区域a是循环 For i = 1 To a.Rows.Count \'如果在a中找到与c相同的值,就把同一行中的b的内容提取出来,存入变量t中。 If a.Cells(i, 1) = c Then t = t & " " & b.Cells(i, 1) Next \'将变量的值赋给自定义函数 abc = t End Function
XY 追问
2022-01-14 11:35
XY 追问
2022-01-14 11:35
小林老师 解答
2022-01-14 11:38
XY 追问
2022-01-14 11:40
XY 追问
2022-01-14 11:41
小林老师 解答
2022-01-14 11:41
XY 追问
2022-01-14 11:42
XY 追问
2022-01-14 11:42
XY 追问
2022-01-14 11:42
小林老师 解答
2022-01-14 11:43
XY 追问
2022-01-14 11:43
XY 追问
2022-01-14 11:44
小林老师 解答
2022-01-14 11:49
小林老师 解答
2022-01-14 11:49