excel 大写转小写
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
方法一:
Sub 大写转小写()
Dim rg As Range, rng As Range
Set rng = Application.InputBox(prompt:="请用鼠标选择需转换的数据区域", Type:=8)
For Each rg In rng
rg = StrConv(rg, vbLowerCase) '将字符串文字转成小写。
Next rg
End Sub
方法二:
Sub 大写转小写()
Dim X, i, j
On Error GoTo ren
Application.ScreenUpdating = False
a = Selection.Address
If a = "" Then Exit Sub
arr1 = Split(a, "$")
If arr1(1) Like "*:" Then
If IsNumeric(Mid(arr1(1), 1, Len(arr1(1)) - 1)) Then
Y = edRange.Column
X = edRange.Columns.count + Y - 1
Y = Split(Cells(1, Y).Address, "$")(1)
X = Split(Cells(1, X).Address, "$")(1)
z = edRange.Rows.count
n = arr1(2)
If z < n Then arr1(2) = z
a = "$" & Y & "$" & arr1(1) & "$" & X & "$" & arr1(2)
Else
a = "$" & Mid(arr1(1), 1, Len(arr1(1)) - 1) & "$" & edRange.Row & ":$" & arr1(2) & "$" & edRange.Rows.count + edRange.Row - 1
End If
End If
If Range(a).Rows.count + Range(a).Columns.count > 2 Then
arr = Range(a).Value
For i = 1 To UBound(arr, 2)
For j = 1 To UBound(arr)
arr(j, i) = LCase(arr(j, i))
Next j
Next i
Range(a).Value = arr
Else
Range(a) = LCase(Range(a))
End If
Application.ScreenUpdating = True
ren:
End Sub