Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default loop through a cell.

I have this:

Function ctTxt(cvTxt As String)
ctTxt = Left(UCase(cvTxt), 1) & "" & Right(cvTxt, Len(cvTxt) - 1)
End Function

Which takes the cell which contains.

hello free world and converts it to Hello free world.

... but how can I make the function loop to say

Hello Free World.

every first letter capitalized.
i'm think combining the Len() and Instr() function to create some type
of loop, but it seems that I'm stuck.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default loop through a cell.

Hi Vincent,

Try this

Function ctTxt(cvTxt As String)
ctTxt = Application.WorksheetFunction.Proper(cvTxt)
End Function

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Vincent Jones" wrote in message
om...
I have this:

Function ctTxt(cvTxt As String)
ctTxt = Left(UCase(cvTxt), 1) & "" & Right(cvTxt, Len(cvTxt) - 1)
End Function

Which takes the cell which contains.

hello free world and converts it to Hello free world.

.. but how can I make the function loop to say

Hello Free World.

every first letter capitalized.
i'm think combining the Len() and Instr() function to create some type
of loop, but it seems that I'm stuck.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default loop through a cell.

Vincent,

two ways.

first
if you string is in cell A1 put this formula in another cell
=proper(A1)

second
using code

Sub ChangeCase()
Range("a1").Value = WorksheetFunction.Proper(Range("a1").Value)
End Sub

Neil

"Vincent Jones" wrote in message
om...
I have this:

Function ctTxt(cvTxt As String)
ctTxt = Left(UCase(cvTxt), 1) & "" & Right(cvTxt, Len(cvTxt) - 1)
End Function

Which takes the cell which contains.

hello free world and converts it to Hello free world.

.. but how can I make the function loop to say

Hello Free World.

every first letter capitalized.
i'm think combining the Len() and Instr() function to create some type
of loop, but it seems that I'm stuck.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Loop Until non-incrementing cell condition met. GBExcel via OfficeKB.com Excel Worksheet Functions 3 November 4th 09 07:47 PM
Loop through last cell/row of used range tkraju via OfficeKB.com Excel Discussion (Misc queries) 1 April 4th 09 04:45 PM
Is it possible to reset the starting cell in a For Loop Ayo Excel Discussion (Misc queries) 2 May 12th 08 06:27 PM
Loop using cell names Matt Excel Programming 3 January 21st 04 09:36 PM
get for loop to go on after blank cell? john_t_h[_12_] Excel Programming 3 January 15th 04 06:35 AM


All times are GMT +1. The time now is 07:32 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"