Filehost.ro - gazduire fisiere
Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
Nou pe simpatie:
sarmaluta2002
Femeie
24 ani
Bucuresti
cauta Barbat
25 - 50 ani
Mrrrr's Forum (VIEW ONLY)ReguliInregistrareLoginPozeNu sunteti logat. Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides /

[EXCEL] VBA To Change Text Case in Selected Cells

Pagini: 1 Moderat de TRaP, TonyTzu
#1
Mrrrr
AdMiN
Postari: 2388
I updated the code from source to act as a toggle, meaning that if you select a cell containing lowercase text, and click the button to the macro below created in your QAT for example, it will turn case to UPPERCASE. If then you click it again it will turn text to lowercase.

If text is mixed, both lower and upper, it will first turn the text into the case opposing the first letters, then if you click it again it will change to the opposite case, eg. if text is wd20EZBX it will first turn all letters to lowercase, then when you click the button again it will turn all letters to uppercase.

Cell selections don't need to be contiguous. You can use the CTRL key on your keyboard to select various cells all around.


Sub Upper_Lower_Toggle()
    For Each x In Selection
        If x.Value Like LCase(x.Value) Then
            x.Value = UCase(x.Value)
        Else
            x.Value = LCase(x.Value)
        End If
    Next
End Sub


Source of original code:
https://support.microsoft.com/en-gb/top ... d611b7e5e1


_______________________________________


 
   
Pagini: 1  
Mergi la