hi experts....
i just want to ask....
how can i use the PROPER function in macros?....because i want to automatically change those text not in PROPER case as soon as i click anywhere on the worksheet...only columns C and D will be affected...thanks a lot...
Application.WorksheetFunction.Proper(Put string variable here)
"tweety127" wrote:
>
> hi experts....
>
> i just want to ask....
>
> how can i use the PROPER function in macros?....because i want to
> automatically change those text not in PROPER case as soon as i click
> anywhere on the worksheet...only columns C and D will be
> affected...thanks a lot...
>
>
> --
> tweety127
> ------------------------------------------------------------------------
> tweety127's Profile: http://www.excelforum.com/member.php...o&userid=34673
> View this thread: http://www.excelforum.com/showthread...hreadid=551002
>
>
sub ConvertString()
Dim cell as Range, rng as range
On Error Resume Next
set rng = selection.SpecialCells(xlconstants,xlTextValues)
On Error goto 0
if not rng is nothing then
for each cell in rng
cell.value = strconv(cell.value,vbProperCase)
Next
End if
end sub
--
Regards,
Tom Ogilvy
"tweety127" wrote:
>
> hi experts....
>
> i just want to ask....
>
> how can i use the PROPER function in macros?....because i want to
> automatically change those text not in PROPER case as soon as i click
> anywhere on the worksheet...only columns C and D will be
> affected...thanks a lot...
>
>
> --
> tweety127
> ------------------------------------------------------------------------
> tweety127's Profile: http://www.excelforum.com/member.php...o&userid=34673
> View this thread: http://www.excelforum.com/showthread...hreadid=551002
>
>
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error GoTo ws_exit
Application.EnableEvents = False
With Target
If .Column = 3 Or .Column = 4 Then
.Value = Application.Proper(.Value)
End If
End With
ws_exit:
Application.EnableEvents = True
On Error GoTo 0
End Sub
This is worksheet event code, which means that it needs to be
placed in the appropriate worksheet code module, not a standard
code module. To do this, right-click on the sheet tab, select
the View Code option from the menu, and paste the code in.
--
HTH
Bob Phillips
(replace xxxx in the email address with gmail if mailing direct)
"tweety127" <tweety127.29aktc_1150120204.9928@excelforum-nospam.com> wrote
in message news:tweety127.29aktc_1150120204.9928@excelforum-nospam.com...
>
> hi experts....
>
> i just want to ask....
>
> how can i use the PROPER function in macros?....because i want to
> automatically change those text not in PROPER case as soon as i click
> anywhere on the worksheet...only columns C and D will be
> affected...thanks a lot...
>
>
> --
> tweety127
> ------------------------------------------------------------------------
> tweety127's Profile:
http://www.excelforum.com/member.php...o&userid=34673
> View this thread: http://www.excelforum.com/showthread...hreadid=551002
>
A Big Thanks To All Of You!!!
![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks