[Excel VBA入門]定数(const)を作成するサンプル

2021年4月8日

書式
Const 定数名 As String(Integer、Double)
使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
Sub Info()
Const CFTA As String = "test001"
Const CFTB As Double = 53.6
Const CFTC As Integer = 123
Debug.Print CFTA
Debug.Print CFTB
Debug.Print CFTC
End Sub
Sub Info() Const CFTA As String = "test001" Const CFTB As Double = 53.6 Const CFTC As Integer = 123 Debug.Print CFTA Debug.Print CFTB Debug.Print CFTC End Sub
Sub Info()
    
    Const CFTA As String = "test001"
    Const CFTB As Double = 53.6
    Const CFTC As Integer = 123

    Debug.Print CFTA
    Debug.Print CFTB
    Debug.Print CFTC
    
   
End Sub

結果
test001
53.6
123

Excel VBA

Posted by arkgame