|
楼主 |
发表于 2018-12-30 15:58:59
|
显示全部楼层
'借用工作表函数
Sub 运用工作表函数()
MsgBox Application.WorksheetFunction.CountIf(range("a1:a10"), "钢笔")
MsgBox WorksheetFunction.CountIf(range("a1:a10"), "钢笔")
MsgBox Application.CountIf(range("a1:a10"), "钢笔")
End Sub
'VBA函数
Sub VBA函数()
MsgBox VBA.Format(range("b1"), "yyyy年m月d日")
MsgBox Format(range("b1"), "yyyy年m月d日")
End Sub
'自定义函数
Function SEX(rng As range)
SEX = IIf(Mid(rng, 15, 3) Mod 2, "男", "女")
End Function
|
|