Page No.258 Dummys
============USER FORM CODE ===================
==============================================
==============================================
Option Explicit
Private Sub CancelButton_Click()
Unload UserForm1
End Sub
Private Sub OKButton_Click()
Dim WorkRange As Range
Dim Cell As Range
'Process only text cells, no formulas
On Error Resume Next
'This enables one cell selection.
If Selection.Count = 1 Then
Set WorkRange = Selection
Else
Set WorkRange = Selection.SpecialCells _
(xlCellTypeConstants, xlCellTypeConstants)
End If
' Upper case
If OptionUpper Then
For Each Cell In WorkRange
Cell.Value = UCase(Cell.Value)
Next Cell
End If
' Lower case
If OptionLower Then
For Each Cell In WorkRange
Cell.Value = LCase(Cell.Value)
Next Cell
End If
' Proper case
If OptionProper Then
For Each Cell In WorkRange
Cell.Value = Application. _
WorksheetFunction.Proper(Cell.Value)
Next Cell
End If
Unload UserForm1
End Sub
============== SUB TO CALL THE FORM ==============
==================================================
==================================================
Sub ChangeCase()
If TypeName(Selection) = "Range" Then
UserForm1.Show
Else
MsgBox "Select a range.", vbCritical
End If
End Sub