# VBA Select Case

Basic Exercise

A hat store intents to make a Black Friday sales promotion. However, before lowering the prices, the store manager decides to adjust the prices up so the given discounts will not reduce the store's margin of sales by much. To do that, he decided that he would follow the following rules:

Initial Price (US$) Adjustment (percentage) 6 to 15 15% 15,01 to 25 25% 25,01 or more 35% After these adjustments are applied, he decided that the Black Friday's discounts should be: Adjusted Price (US$) Discount (percentage)
6 to 15 10%
15,01 to 22 17.5%
22,01 to 33 25%
33,01 or more 30%

The hat store manager has given you the task to calculate the final discount price of the products and to compare it with their original values. The items that actually had their prices lowered by the store's "discount" should be colored green.

## Suggested Concepts:

• Dim - Declares a variable.
• For Next - Repeats a group of statements a specified number of times.
• If Else - Conditionally executes a group of statements, depending on the value of an expression.
• Select Case - Runs one of several groups of statements, depending on the value of an expression.
• End with .Row - Find the last row with data.
• Cells - Allows VBA to interact with cells in the worksheet.

Remember that in most cases there is more than one way to solve the exercise.

Hint: Make one Select Case statement for an increased final price and another one for a price with an actual discount both within the same For Next loop

Show Answer

SuperExcelVBA.com is learning website. Examples might be simplified to improve reading and basic understanding. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. All Rights Reserved.

Excel ® is a registered trademark of the Microsoft Corporation.

© 2021 SuperExcelVBA | ABOUT