美文网首页
一个过程Sub 大小写切换(VBA)

一个过程Sub 大小写切换(VBA)

作者: 萍水相逢1979 | 来源:发表于2020-09-24 15:29 被阅读0次
Public Sub Aa()
    If testing Then Exit Sub
    On Error GoTo ErrorHandler

    Dim cell As Object
    Dim prefix As String
    For Each cell In Selection.Cells
        prefix = cell.PrefixCharacter

        If cell.EntireColumn.Hidden = False And cell.EntireRow.Hidden = False Then
            If cell = UCase(cell) Then
                cell = prefix & LCase(cell)
                Exit Sub
            End If
            
            If cell = LCase(cell) Then
                cell = prefix & UCase(cell)
                Exit Sub
            End If
        End If
    Next
    
ErrorHandler:
    If Err.Number <> 0 Then
        MyMsgBox Err.Number & " " & Err.Description, 30
    End If
End Sub

相关文章

网友评论

      本文标题:一个过程Sub 大小写切换(VBA)

      本文链接:https://www.haomeiwen.com/subject/iwcnyktx.html