我需要编写一个电子表格,当您按下按钮时会添加一行数据并询问计算所需的参数,但我似乎无法正确处理,这真的让我感到沮丧,任何帮助将不胜感激。我是 excel 中宏的完整初学者,并且只在我的 uni 课程中为 matlab 完成了非常基本的编程。到目前为止,我的脚本如下:
Sub AddPosTol()
'
' AddPosTol Macro
'
Dim rngSeek As Range
Set rngSeek = Range("A1").End(xlDown).Offset(1, 0)
With rngSeek.Offset(0, 1)
With .Font
.Name = "Solid Edge ANSI1 Symbols"
.Size = 11
End With
End With
Range(rngSeek).Offset(0, 1) = "l"
Range(rngSeek).Offset(0, 3) = "=RC[-1]"
Range(rngSeek).Offset(0, 4) = "0"
With rngSeek.Offset(1, 1)
With .Font
.Bold = True
End With
End With
Range(rngSeek).Offset(1, 1) = "X value"
Range(rngSeek).Offset(2, 1) = "Y Value"
Range(rngSeek).Offset(0, 4) = "=2*SQRT((R[1]C[-3]-R[1]C)^2+(R[2]C[-3]-R[2]C)^2)"
Range(rngSeek).Offset(0, 5) = "=2*SQRT((R4C3-R[1]C)^2+(R5C3-R[2]C)^2)"
Range(rngSeek).Offset(0, 6) = "=2*SQRT((R[1]C[-3]-R[1]C)^2+(R[2]C[-3]-R[2]C)^2)"
Range(rngSeek).Offset(0, 7) = "=2*SQRT((R[1]C[-3]-R[1]C)^2+(R[2]C[-3]-R[2]C)^2)"
Range(rngSee).Offset(0, 8) = "=2*SQRT((R4C3-R[1]C)^2+(R5C3-R[2]C)^2)"
Range(rngSeek).Offset(0, 2) = (InputBox("Insert Positional Tolerance Diametre"))
Range(rngSeek).Offset(1, 2) = (InputBox("Insert X value on drawing"))
Range(rngSeek).Offset(2, 2) = (InputBox("Insert Y value on drawing"))
End Sub