Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
magix
 
Posts: n/a
Default Excel VBA - Check/Format String

Hi,

I would like to check and format string from a cell if a condition is met,
via using macro button.
Condition: if there is apostrophe in that string, the following letter
after apostrophe must be lowercase. if the following letter is a space, then
nothing happen.

Of course, if I select multiple cells, it will check each of them.

Thanks in advance.

Regards,
Magix


  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default Excel VBA - Check/Format String


Dim cell As Range
Dim iPos As Long

For Each cell In Selection
iPos = InStr(cell.Value, ",")
If iPos 0 Then
cell.Value = Left(cell.Value, iPos) & _
UCase(Mid(cell.Value, iPos + 1, 1)) & _
Right(cell.Value, Len(cell.Value) - iPos -
1)
End If
Next cell


--

HTH

RP
(remove nothere from the email address if mailing direct)


"magix" wrote in message
...
Hi,

I would like to check and format string from a cell if a condition is met,
via using macro button.
Condition: if there is apostrophe in that string, the following letter
after apostrophe must be lowercase. if the following letter is a space,

then
nothing happen.

Of course, if I select multiple cells, it will check each of them.

Thanks in advance.

Regards,
Magix




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
Microsoft Excel in Microsoft works - how to open R J Gavin Excel Discussion (Misc queries) 3 September 16th 05 08:29 PM
excel 4.0 macro removal tool Sachin Shah Excel Discussion (Misc queries) 0 August 25th 05 04:17 AM
How do I search for a string across multiple worksheets in Excel? BBiletch Excel Worksheet Functions 2 April 5th 05 11:59 PM
Excel Database Query String Too Long Karl Burrows Excel Discussion (Misc queries) 4 January 27th 05 06:25 AM
Difference in number of Excel NewsGroups Hari Prasadh Excel Discussion (Misc queries) 1 January 25th 05 11:32 AM


All times are GMT +1. The time now is 04:30 PM.

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"