ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   use of PROPER function in Macros (https://www.excelbanter.com/excel-programming/364001-use-proper-function-macros.html)

tweety127[_23_]

use of PROPER function in Macros
 

hi experts....

i just want to ask....

how can i use the PROPER function in macros?....because i want t
automatically change those text not in PROPER case as soon as i clic
anywhere on the worksheet...only columns C and D will b
affected...thanks a lot..

--
tweety12
-----------------------------------------------------------------------
tweety127's Profile: http://www.excelforum.com/member.php...fo&userid=3467
View this thread: http://www.excelforum.com/showthread.php?threadid=55100


Paul Mathews

use of PROPER function in Macros
 
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



Tom Ogilvy

use of PROPER function in Macros
 
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



Bob Phillips

use of PROPER function in Macros
 
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" wrote
in message ...

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




tweety127[_24_]

use of PROPER function in Macros
 

:) A Big Thanks To All Of You!!! :

--
tweety12
-----------------------------------------------------------------------
tweety127's Profile: http://www.excelforum.com/member.php...fo&userid=3467
View this thread: http://www.excelforum.com/showthread.php?threadid=55100



All times are GMT +1. The time now is 03:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com