|
こんにちは
結局、小数点以下があるかないか判定してピリオドを付けるか付けないかすれば
いいと思います。
Sub 外径面取5()
Dim 行番号 As Long
Dim A As Long
Dim B As Long
Dim C As Long
Dim D As Long
Dim E As Long
Dim F As Long
Dim H As Long
Dim I As Long
Dim kakudo As Double
Dim R As String
Dim Z As String
Dim tmpD1 As Double
Dim tmpD2 As Double
A = 1
B = 2
C = 3
D = 4
E = 5
F = 6
H = 8
I = 9
kakudo = 0.01745329252
With ActiveSheet
For 行番号 = 2 To 9999
If .Cells(行番号, B).Value = "" Then
Exit For
Else
tmpD1 = WorksheetFunction.Round(.Cells(行番号, E).Value, 3)
tmpD2 = WorksheetFunction.Round((.Cells(行番号, F).Value - _
.Cells(行番号, C).Value * Tan(.Cells(行番号, D).Value * kakudo) _
* Tan((90 - .Cells(行番号, D).Value) * kakudo) - _
.Cells(行番号, B).Value), 3)
Z = IIf(tmpD1 = Int(tmpD1), ".Z", "Z")
R = IIf(tmpD2 = Int(tmpD2), ".R", "R")
.Cells(行番号 + 3, H).Value = _
"G3" & "X" & tmpD1 & Z & tmpD2 & R & Cells(行番号, B).Value
End If
Next 行番号
End With
End Sub
|
|