Select Case

TheMatrixReloaded

New Member
Joined
May 6, 2002
Messages
29
Isn't there a way I can do this code with a select case statement?

If OPTPan.Value = True Then
Sheets("Order Table").Range("C" & intcurrentrow).Value = "Personal"
Sheets("Order Table").Range("D" & intcurrentrow).Value = 4.99 + 0.5 * bytToppings
End If
If OPT10inch.Value = True Then
Sheets("Order Table").Range("C" & intcurrentrow).Value = "10 inch"
Sheets("Order Table").Range("D" & intcurrentrow).Value = 5.99 + 0.5 * bytToppings
End If

If OPT12inch.Value = True Then
Sheets("Order Table").Range("C" & intcurrentrow).Value = "12 inch"
Sheets("Order Table").Range("D" & intcurrentrow).Value = 7.99 + 0.5 * bytToppings
End If

If OPT14inch.Value = True Then
Sheets("Order Table").Range("C" & intcurrentrow).Value = "14 inch"
Sheets("Order Table").Range("D" & intcurrentrow).Value = 9.99 + 0.5 * bytToppings
End If

If OPT16inch.Value = True Then
Sheets("Order Table").Range("C" & intcurrentrow).Value = "16 inch"
Sheets("Order Table").Range("D" & intcurrentrow).Value = 10.99 + 0.5 * bytToppings
End If
If OPTSicilian.Value = True Then
Sheets("Order Table").Range("C" & intcurrentrow).Value = "Sicilian"
Sheets("Order Table").Range("D" & intcurrentrow).Value = 11.5 + 0.5 * bytToppings
End If
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Change from Option buttons to a dropdown list that the user selects one length.
The length is then assigned to a variable ie
VarLength.

Now you can do a:
Select case Varlen
Case 10in
case 12in
case etc etc
 
Upvote 0

Forum statistics

Threads
1,214,620
Messages
6,120,554
Members
448,970
Latest member
kennimack

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top