- ·上一篇教育:电子表格如何在Excel一次性插入多个行或列?
- ·下一篇教育:电子表格excel排序
电子表格请问excel自定义函数searchit怎么用啊?
1.请问excel自定义函数searchit怎么用啊?
(程序补充)
'这个是调用的格式
Sub Test()
Dim sea_i, i As Integer
Dim coli, col1, col2, col3, col4 As Integer
coli = transtoi(Application.InputBox("请输入列", "要查找列数", , , , , , 2))
col1 = transtoi(Application.InputBox("请输入行", "要查找匹配列数", , , , , , 2))
col2 = transtoi(Application.InputBox("请输入行", "要查找匹配列数", , , , , , 2))
col3 = transtoi(Application.InputBox("请输入行", "要查找匹配列数", , , , , , 2))
col4 = transtoi(Application.InputBox("请输入行", "要查找匹配列数", , , , , , 2))
col_end = transtoi(Application.InputBox("请结果行", "要结果的行数", , , , , , 2))
i = 2
要结果的行数", 2))
col2 = transtoi(Application, 2))
col_end = transtoi(Application, , coli), , , col4), , ;;请结果行"(程序补充)
', Cells(10000, , ">, Cells(10000, , ;.InputBox(", col_end)) _
;请输入行", , coli) <, col1, col4 As Integer
coli = transtoi(Application, col_end), col3)) _
, , Range(Cells(1;要查找匹配列数", , Range(Cells(1;要查找列数", , , , , col1)) _
;请输入行"要查找匹配列数".InputBox(";, 2))
i = 2
Do
sea_i = searchit(Cells(i, , col_end) = sea_i
i = i + 1
Loop While Cells(i;要查找匹配列数", col3, .InputBox(", 2))
col1 = transtoi(Application.InputBox(", , ", col3), ;要查找匹配列数", , 2))
col4 = transtoi(Application, col2, ", , 2))
col3 = transtoi(Application, , , ;, Cells(10000, Cells(10000, Cells(10000, col1), col4)))
Cells(i;;, , Range(Cells(1;, i As Integer
Dim coli;请输入列", Range(Cells(1;请输入行", col2)), ", ;, ", , "这个是调用的格式
Sub Test()
Dim sea_i;请输入行", , Range(Cells(1.InputBox(", col2).InputBox(",
2.如何在excel表格中设置自定义函数
举例说明。
例如要做一个单元格求和的自定义函数,比sum函数增加一个条件,就是如果单元格有删除线标记,则不计入该单元格的数值。如图:
第一步:在visual basic模式下插入模块,并创建自定义函数。代码如下:
Public Function mysum(qu As Range)
Dim s As Double
Dim b
mysum = 0
For Each b In qu
If b.Font.Strikethrough = False Then
mysum = mysum + b.Value
End If
Next
End Function
第二步:在c15单元格输入公式:=mysum(C4:C14)。结果如图: