hi
i tried a macros for changing case in excel through userform. when im pressing alt+f8 and running the macros it showing the error. Can any one rectify the error.
hi
i tried a macros for changing case in excel through userform. when im pressing alt+f8 and running the macros it showing the error. Can any one rectify the error.
You need to use the correct quote characters
[VBA]Private Sub CancelButton_Click()
Unload UserForm1
End Sub
Private Sub OKButton_Click()
Application.ScreenUpdating = False
' Exit if a range is not selected
If TypeName(Selection) <> "Range" Then Exit Sub
' Upper case
If OptionUpper Then
For Each cell In Selection
If Not cell.HasFormula Then
cell.Value = StrConv(cell.Value, vbUpperCase)
End If
Next cell
End If
' Lower case
If OptionLower Then
For Each cell In Selection
If Not cell.HasFormula Then
cell.Value = StrConv(cell.Value, vbLowerCase)
End If
Next cell
End If
'Proper case
If OptionProper Then
For Each cell In Selection
If Not cell.HasFormula Then
cell.Value = StrConv(cell.Value, bProperCase)
End If
Next cell
End If
Unload UserForm1
End Sub
[/VBA]
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
or
[VBA]
Private Sub OKButton_Click()
For Each cl In Selection.SpecialCells(2)
cl.Value = StrConv(cl, IIf(OptionUpper, 1, IIf(OptionLower, 2, 3)))
Next
Hide
End Sub
[/VBA]
thank you . Its working fine