Three macros will handle three types of case changes. However, there is another solution in Excel VBA. Using this link, you can create a userform that will change cases to Upper, Lower or Proper. The created UserForm is displayed by a VBA macro. You can create this type of custom dialog box using UserForm in the Visual Basic (VB) Editor. Like in the following figure, you can make a dialog box to ask the user to know what type of case change she/he wants. For example, the macro would be more useful if it could also change the cells to lowercase or proper case (only the first letter of each word is uppercase). This macro is useful, but you can improve it. Sub ChangeCase()Ĭell.Value = StrConv (cell.Value, vbUpperCase) The procedure uses VBA’s built-in StrConv function. But if the cell range has a formula, the macro does not change anything. The following macro changes the text of a selected cell range to uppercase. In such cases, the macro may use custom dialog boxes ( UserForm). You can develop the above macro in such a way that it will work with different data in different circumstances. So, this macro is developed to do the same thing every time. This macro uses the above sales data and calculates something using these data as per your requirement and then shows the results in another portion of your Excel sheet. You have some sales data recorded on the worksheet. The Reason Behind Creating Your Own UserFormįor example, you have an Excel worksheet.
0 Comments
Leave a Reply. |