I have created a custom toolbar and have placed several buttons on it to run common macros that I use.
I have 3 macros that changes the case of the text - proper, upper and lower. Instead of having 3 macros. Is there a way I can combine those macros to one and when I click the button, a popup will display Upper/Lower/Proper? I can then select the one I want.
These are the 3 the macros that I am use.
Can anyone help me?
I have 3 macros that changes the case of the text - proper, upper and lower. Instead of having 3 macros. Is there a way I can combine those macros to one and when I click the button, a popup will display Upper/Lower/Proper? I can then select the one I want.
These are the 3 the macros that I am use.
Code:
Sub LowerCase()
Dim cell As Range
For Each cell In Selection.Cells
If cell.HasFormula = False Then
cell = LCase(cell)
End If
Next
End Sub
Code:
Sub UpperCase()
Dim cell As Range
For Each cell In Selection.Cells
If cell.HasFormula = False Then
cell = UCase(cell)
End If
Next
End Sub
Code:
Sub MakeProper()
Dim rngSrc As Range
Dim lMax As Long, lCtr As Long
Set rngSrc = ActiveSheet.Range(ActiveWindow.Selection.Address)
lMax = rngSrc.Cells.Count
For lCtr = 1 To lMax
If Not rngSrc.Cells(lCtr).HasFormula Then
rngSrc.Cells(lCtr) = Application.Proper(rngSrc.Cells(lCtr))
End If
Next lCtr
End Sub