As you often know with friends in Word, you can easily change English characters ' uppercase ', ' lowercase ', ' first-letter ' and ' first-letter capitals ' in Word.
However, these features Excel do not have, if you want to use these features in Excel, you must manually modify or use complex formulas for conversion. In fact, we can write related macros to solve this problem once and for all.
First draw four command buttons to change the text on the button to "all caps", "all lowercase", "uppercase" and "uppercase". Then write the corresponding macro code for each button individually.
For example, "All Caps" button, enter the code:
Code fragment:
Double-click the code to select all
1 2 3 4, 5 6 7 8 9 10 11 12 13 14 15 |
Sub 全部大写() Dim itarget As Range Set itarget = Selection For Each ran In itarget '将单元格内容转换为大写形式 ran.value = UCase(ran) Next End Sub
|
Right-click the All Lowercase button and enter the code:
Double-click the code to select all
1 2 3 4, 5 6 7 8 9 10 11 12 13 14 15 |
Sub 全部小写() Dim itarget As Range Set itarget = Selection For Each ran In itarget '将单元格内容转换为小写形式 ran.value = LCase(ran) Next End Sub
|
The button is ready to use when you have completed the above operation. Select the target cell range and click the corresponding conversion button, and the selected English character is converted to the size we want.