|
SelectCaseの入れ子でコードを書き直すとどのように
成るでしょうか。
一般と会員の割引率が異なるコードをSelectCaseで作ったのですが…
Dim kingaku As Currency
Dim kubun As String
kubun = Range("D33").Value
kingaku = Range("C33").Value
Select Case kubun '…Range("D33")
Case Is = "一般"
Select Case kingaku '…Range("C33")
Case Is >= 50000
MsgBox "15%割引です"
Case Is >= 30000 And kingaku < 50000
MsgBox "10%割引です"
Case Is >= 10000 And kingaku < 30000
MsgBox "5%割引です"
Case Else
MsgBox "割引対象外です"
End Select
End Select
Select Case kubun
Case Is = "会員"
Select Case kingaku
Case Is >= 50000
MsgBox "40%割引です"
Case Is >= 30000 And kingaku < 50000
MsgBox "30%割引です"
Case Is >= 10000 And kingaku < 30000
MsgBox "10%割引です"
Case Else
MsgBox "割引対象外です"
End Select
End Select
|
|