1、首先在开发工具中打开VBA编辑器

2、在单元格区域当中输入一些内容作为例子

3、在VBA编辑器中插入模块

4、在模块当中输入如下代码,然后运行
Private Sub Worksheet_Change(ByVal Target As Range)
If IsEmpty(Target) Then Exit Sub
If Target.Cells.Count > 1 Then Exit Sub
If Target.Column <> 2 Then Exit Sub
Application.EnableEvents=False
Target.Value=UCase(Target.Value)
Application.EnableEvents=True
End Sub

5、在A列输入小写字母将显示为小写状态,在B列输入小写字母则自动转换为大写状态。
