VBA构造函数就是这么简单

Function test(a As Integer)'构造函数名字为test参数为a且为int型
  If a >= 90 Then
     Debug.Print "优秀"
     test = "优秀" '赋值到单元格,跨表依然适用
  ElseIf a >= 60 Then
     Debug.Print "及格"
     test = "及格"
  Else
     Debug.Print "不及格"
     test = "不及格"
  End If
 
End Function

猜你喜欢

转载自www.cnblogs.com/xwenwu/p/11759949.html