Excel中怎么设置输入的字母全部自动变大写?
1个回答
展开全部
Private Sub Worksheet_SelectionChange(ByVal Target As Range) '工作表选定区域发生改变时执行
Dim b1 As Boolean
Dim a, b, c, d As Variant
Dim I, J As Integer
Set myDocument = ThisWorkbook.Worksheets("Sheet1") '‘Sheet1’为当前工作簿
For I = 2 To 1000 '循环2-1000次,即:D2单元格以下大小写改变到1000行
a = myDocument.Cells(I, 1) '将单元格赋值给a
b = myDocument.Cells(I, 2)
c = myDocument.Cells(I, 3)
d = myDocument.Cells(I, 4)
b1 = WorksheetFunction.And(d <> "") '条件:当D列单元敏喊不为空时
If b1 = True Then '桥晌野当单元谨派格输入内容时,则执行自动大小写改变
myDocument.Cells(I, 4) = UCase(myDocument.Cells(I, 4)) '引用当前单元格内容,4为第几列的意思(D列)
End If
Next
End Sub
Sub 大小写改变()
End Sub
Dim b1 As Boolean
Dim a, b, c, d As Variant
Dim I, J As Integer
Set myDocument = ThisWorkbook.Worksheets("Sheet1") '‘Sheet1’为当前工作簿
For I = 2 To 1000 '循环2-1000次,即:D2单元格以下大小写改变到1000行
a = myDocument.Cells(I, 1) '将单元格赋值给a
b = myDocument.Cells(I, 2)
c = myDocument.Cells(I, 3)
d = myDocument.Cells(I, 4)
b1 = WorksheetFunction.And(d <> "") '条件:当D列单元敏喊不为空时
If b1 = True Then '桥晌野当单元谨派格输入内容时,则执行自动大小写改变
myDocument.Cells(I, 4) = UCase(myDocument.Cells(I, 4)) '引用当前单元格内容,4为第几列的意思(D列)
End If
Next
End Sub
Sub 大小写改变()
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询