感谢你们。根据回复,再深入一点,我保持我的代码是这样的:
Public Function LowHigh(custo As Integer)
If custo > 10.99 And custo <> 0 Then
LowHigh = "1.4"
Else
If custo < 11 And custo <> 0 Then
LowHigh = "1.35"
Else
If custo <= 0 Then
LowHigh = "Valor Inválido"
End If
End If
End If
End Function
Public Sub lorh()
ActiveCell.Formula = "=LowHigh(" & ActiveCell.Offset(0, 0).End(xlToLeft).Address & ")"
End Sub
在选择有问题的正确值并按下按钮时,forfunção LowHigh 运行,问题是它需要逐个单元格完成,我需要选择左侧的整个范围并立即单击按钮单元格右侧间隔是填充公式如下图: 最终图像
我试过这样的事情:
Public Function LowHigh (cost As Integer)
If cost> And cost 10.99 <> 0 Then
LowHigh = "1.4"
else
If cost <11 And cost <> 0 Then
LowHigh = "1:35"
else
If cost <= 0 Then
LowHigh = "Invalid"
end If
end If
end If
end Function
Public Sub lorh ()
Range ("ActiveCell", "ActiveCell"). FormulaR1C1 = "LowHigh = (" & Range (ActiveCell.Offset (0, 0). End (xlToLeft)). & Address ")"
end Sub
但它没有用,你能帮帮我吗?