(1)
x = 5
(2)
x = InputBox("数字を入力してください")
|
Option Explicit Sub Main() Dim x As Integer, y As Integer x = ThisComponent.Sheets(0).getCellByPosition(0, 0).Value MsgBox "A1 (0, 0) の値は " & x y = ThisComponent.Sheets(0).getCellByPosition(0, 1).Value MsgBox "A2 (0, 1) の値は " & y ThisComponent.Sheets(0).getCellByPosition(1, 0).Value = x + y End Sub |
Option Explicit
Sub Main()
Dim x As Integer, y As Integer
With ThisComponent.Sheets(0)
x = .getCellByPosition(0, 0).Value
MsgBox "A1 (0, 0) の値は " & x
y = .getCellByPosition(0, 1).Value
MsgBox "A2 (0, 1) の値は " & y
.getCellByPosition(1, 0).Value = x + y
End With
End Sub
|
Option Explicit
Sub Main()
Dim x1 As Double, x2 As Double
Dim n As Integer, nd As Integer
Dim x As Double, y As Double, dx As Double
x1 = -3.14
x2 = 3.14
nd = 60
dx = (x2 - x1) / nd
ThisComponent.addActionLock() ' 書き終るまで描画をロック
For n = 0 To nd
x = x1 + dx * n
y = Sin(x)
ThisComponent.Sheets(0).getCellByPosition(0, n).Value = x
ThisComponent.Sheets(0).getCellByPosition(1, n).Value = y
Next n
ThisComponent.removeActionLock() ' 書き終えたので描画ロックを解除
End Sub
|