君たちありがとう。応答に基づいて、もう少し深く掘り下げると、コードを次のように保ちました。
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
問題の正しい値を選択してボタンを押すと、関数 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
うまくいきませんでしたが、助けてもらえますか?