LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 134
Default Substitute chr(39)

Hi,

I made function (see below) to substitute mistake input into right input

eg. when I type the letter O, I substitute in zero 0

I also like to let the laptop-user (AZERTY-keyboard layout) use the upper
row of the keyboard without shift pressed in to get figures so I substitute
& by 1, é by 2 etc.

Everything works fine, except for 4 because the ' sign (chr(39)) is used to
tell excel this is text. I cannot substitute ' in 4 if it is in the
beginning of my input (I works right for (' to make 54 but not '( in 45)

Can anyone help to substitute ' in 4 when it's in the beginning of my input?

Thanks,
Jos Vens

Here goes my code

Function SET_Value(vInput As Range)

Dim vSubstitute

vSubstitute = vInput
vSubstitute = WorksheetFunction.Substitute(vSubstitute, ",", ".")
vSubstitute = WorksheetFunction.Substitute(vSubstitute, "O", "0")
vSubstitute = WorksheetFunction.Substitute(vSubstitute, "o", "0")
vSubstitute = WorksheetFunction.Substitute(vSubstitute, "_", "-")

vSubstitute = WorksheetFunction.Substitute(vSubstitute, "&", "1")
vSubstitute = WorksheetFunction.Substitute(vSubstitute, "é", "2")
vSubstitute = WorksheetFunction.Substitute(vSubstitute, """", "3")

vSubstitute = WorksheetFunction.Substitute(vSubstitute, Chr(39), "4")
'vSubstitute = WorksheetFunction.Substitute(vSubstitute, "'", "4") '-does
not work either

vSubstitute = WorksheetFunction.Substitute(vSubstitute, "(", "5")
vSubstitute = WorksheetFunction.Substitute(vSubstitute, "§", "6")
vSubstitute = WorksheetFunction.Substitute(vSubstitute, "è", "7")
vSubstitute = WorksheetFunction.Substitute(vSubstitute, "!", "8")
vSubstitute = WorksheetFunction.Substitute(vSubstitute, "ç", "9")
vSubstitute = WorksheetFunction.Substitute(vSubstitute, "à", "0")

vInput = vSubstitute

End Function


 
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
Substitute Trish Excel Worksheet Functions 7 April 28th 09 08:58 PM
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE.... max. limit 8 :( [email protected] Excel Discussion (Misc queries) 6 May 22nd 08 05:33 PM
More than 7 IF? any substitute? Jean Excel Worksheet Functions 4 March 9th 07 05:41 AM
SUBSTITUTE Steved Excel Worksheet Functions 4 June 2nd 06 06:51 PM
Using &Chr$(39)& as substitute for ' in VBA Paul987 Excel Discussion (Misc queries) 4 March 15th 06 02:48 PM


All times are GMT +1. The time now is 03:45 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"