Proper
What is the vba equivalent to the worksheet proper
function? |
Hi
you could always use application.worksheetfunction.proper -- Regards Frank Kabel Frankfurt, Germany !!! wrote: What is the vba equivalent to the worksheet proper function? |
There is none so you can use
Application.Proper(Range("A1")) as an example Regards, Peo Sjoblom "!!!" wrote: What is the vba equivalent to the worksheet proper function? |
Hi ....,
and if you would like to refine and improve usage in your macro for lastnames such as my own, and for a correct title case as in "A Year to Remember" take a look at http://www.mvps.org/dmcritchie/excel/proper.htm You would still have to make some adjustments but that should get you a better start. -- HTH, David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001] My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm Search Page: http://www.mvps.org/dmcritchie/excel/search.htm "Peo Sjoblom" wrote... There is none so you can use Application.Proper(Range("A1")) What is the vba equivalent to the worksheet proper function? |
VBA has its own builtin function, too:
Option Explicit Sub testme() Dim myStr As String myStr = "now is the TIME FOr all good MEN TO COME..." myStr = StrConv(myStr, vbProperCase) MsgBox myStr End Sub "!!!" wrote: What is the vba equivalent to the worksheet proper function? -- Dave Peterson |
Proper
Try this,
Range("A1").Value=Application.WorksheetFunction.Pr oper(Range("A1").Value) Mike On Mon, 6 Dec 2004 09:01:08 -0800, "!!!" wrote: What is the vba equivalent to the worksheet proper function? |
Proper
Or StrConv.
Mike, H wrote: Try this, Range("A1").Value=Application.WorksheetFunction.Pr oper(Range("A1").Value) Mike On Mon, 6 Dec 2004 09:01:08 -0800, "!!!" wrote: What is the vba equivalent to the worksheet proper function? -- Dave Peterson |
Proper
Specifically (to match Mike's example)...
Range("A1").Value = StrConv(Range("A1").Value, vbProperCase) where the predefined vbProperCase constant tells it to perform the proper case conversion. Rick "Dave Peterson" wrote in message ... Or StrConv. Mike, H wrote: Try this, Range("A1").Value=Application.WorksheetFunction.Pr oper(Range("A1").Value) Mike On Mon, 6 Dec 2004 09:01:08 -0800, "!!!" wrote: What is the vba equivalent to the worksheet proper function? -- Dave Peterson |
Proper
StrConv is quite a bit faster. 8 times faster, according to my
calculations. On Feb 21, 7:38*pm, "Rick Rothstein \(MVP - VB\)" wrote: Specifically (to match Mike's example)... Range("A1").Value = StrConv(Range("A1").Value, vbProperCase) where the predefined vbProperCase constant tells it to perform the proper case conversion. Rick "Dave Peterson" wrote in message ... Or StrConv. Mike, H wrote: Try this, Range("A1").Value=Application.WorksheetFunction.Pr oper(Range("A1").Value) Mike On Mon, 6 Dec 2004 09:01:08 -0800, "!!!" wrote: What is the vba equivalent to the worksheet proper function? -- Dave Peterson |
All times are GMT +1. The time now is 11:33 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com