|
- Sub 替换()
- arr = Range("b3:b" & [b65536].End(3).Row)
- ReDim brr(1 To UBound(arr), 1 To 1)
- For i = 1 To UBound(arr)
- x = arr(i, 1)
- If Len(x) Then
- If Right(x, 2) = ".0" Then x = Left(x, Len(x) - 2) '去掉".0"
-
- If x Like "□*" Then '处理带"□"的情况
- xrr = Split(x, "*")
- If UBound(xrr) = 1 Then '表示只有一个*
- x = xrr(0) & "*" & Replace(xrr(0), "□", "") & "*" & xrr(1)
- End If
- End If
-
- For k = 1 To Len(x) '首字母大写
- y = Asc(Mid(x, k, 1))
- If (y > 64 And y < 91) Or (y > 96 And y < 123) Then
- Mid(x, k, 1) = UCase(Mid(x, k, 1))
- Else
- Exit For
- End If
- Next
-
- For k = Len(x) To 1 Step -1 '尾字母小写
- y = Asc(Mid(x, k, 1))
- If (y > 64 And y < 91) Or (y > 96 And y < 123) Then
- Mid(x, k, 1) = LCase(Mid(x, k, 1))
- Else
- Exit For
- End If
- Next
- End If
- brr(i, 1) = x
- Next
- [d3].Resize(UBound(brr), 1) = brr
- End Sub
复制代码 |
|