Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: Select Case

  1. #1
    New Member
    Join Date
    May 2002
    Location
    Baltimore
    Posts
    29
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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

  2. #2
    MrExcel MVP
    Join Date
    Apr 2002
    Location
    Vancouver BC , Canada
    Posts
    6,259
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •