Making Excel understand the diffrence in capitialization?

  • Thread starter Thread starter Shaka215
  • Start date Start date
S

Shaka215

Hey,

Interesting problem...How do I go about doing this? I need Excel to
understand the value of capitalized letters and not automatically
replace based on its value... Take a look at code below.

Sub Eng_to_code

Application.ScreenUpdating = False
ActiveCell.Replace What:="A", Replacement:="Ø"
ActiveCell.Replace What:="a", Replacement:="-æ-"

End Sub

Sub Code_to_Eng

Application.ScreenUpdating = False
ActiveCell.Replace What:="Ø", Replacement:="A"
ActiveCell.Replace What:="-æ-", Replacement:="a"

End Sub

The problem is the code automatically makes the value of the cell into
"ØØ" if "Aa" is the active cell value when it should be "Ø-æ-". Any
ideas on how to get VB to understand the diffrence of a capital
letter? Thanks!
 
What about setting the MatchCase argument to True?

NickHK

Hey,

Interesting problem...How do I go about doing this? I need Excel to
understand the value of capitalized letters and not automatically
replace based on its value... Take a look at code below.

Sub Eng_to_code

Application.ScreenUpdating = False
ActiveCell.Replace What:="A", Replacement:="Ø"
ActiveCell.Replace What:="a", Replacement:="-æ-"

End Sub

Sub Code_to_Eng

Application.ScreenUpdating = False
ActiveCell.Replace What:="Ø", Replacement:="A"
ActiveCell.Replace What:="-æ-", Replacement:="a"

End Sub

The problem is the code automatically makes the value of the cell into
"ØØ" if "Aa" is the active cell value when it should be "Ø-æ-". Any
ideas on how to get VB to understand the diffrence of a capital
letter? Thanks!
 
Selection.Replace What:="A", Replacement:="Ø", MatchCase:=True

hth,

Doug

Hey,

Interesting problem...How do I go about doing this? I need Excel to
understand the value of capitalized letters and not automatically
replace based on its value... Take a look at code below.

Sub Eng_to_code

Application.ScreenUpdating = False
ActiveCell.Replace What:="A", Replacement:="Ø"
ActiveCell.Replace What:="a", Replacement:="-æ-"

End Sub

Sub Code_to_Eng

Application.ScreenUpdating = False
ActiveCell.Replace What:="Ø", Replacement:="A"
ActiveCell.Replace What:="-æ-", Replacement:="a"

End Sub

The problem is the code automatically makes the value of the cell into
"ØØ" if "Aa" is the active cell value when it should be "Ø-æ-". Any
ideas on how to get VB to understand the diffrence of a capital
letter? Thanks!
 
What about setting the MatchCase argument to True?

NickHK


Hey,

Interesting problem...How do I go about doing this? I need Excel to
understand the value of capitalized letters and not automatically
replace based on its value... Take a look at code below.

Sub Eng_to_code

Application.ScreenUpdating = False
ActiveCell.Replace What:="A", Replacement:="Ø"
ActiveCell.Replace What:="a", Replacement:="-æ-"

End Sub

Sub Code_to_Eng

Application.ScreenUpdating = False
ActiveCell.Replace What:="Ø", Replacement:="A"
ActiveCell.Replace What:="-æ-", Replacement:="a"

End Sub

The problem is the code automatically makes the value of the cell into
"ØØ" if "Aa" is the active cell value when it should be "Ø-æ-". Any
ideas on how to get VB to understand the diffrence of a capital
letter? Thanks!

Nick,

Tried the following... and still had no resolution. The screen
flickers but it doesn't do anything more...maybe I'm missing
something? Thanks for the help man!

Sub Eng_to_code()
Application.ScreenUpdating = False
ActiveCell.Replace What:="A", Replacement:="Ø", MatchCase:=True
ActiveCell.Replace What:="a", Replacement:="-æ-", MatchCase:=True
End Sub


Sub Code_to_Eng()
Application.ScreenUpdating = False
ActiveCell.Replace What:="Ø", Replacement:="A", MatchCase:=True
ActiveCell.Replace What:="-æ-", Replacement:="a", MatchCase:=True
End Sub
 
Selection.Replace What:="A", Replacement:="Ø", MatchCase:=True

hth,

Doug


Hey,

Interesting problem...How do I go about doing this? I need Excel to
understand the value of capitalized letters and not automatically
replace based on its value... Take a look at code below.

Sub Eng_to_code

Application.ScreenUpdating = False
ActiveCell.Replace What:="A", Replacement:="Ø"
ActiveCell.Replace What:="a", Replacement:="-æ-"

End Sub

Sub Code_to_Eng

Application.ScreenUpdating = False
ActiveCell.Replace What:="Ø", Replacement:="A"
ActiveCell.Replace What:="-æ-", Replacement:="a"

End Sub

The problem is the code automatically makes the value of the cell into
"ØØ" if "Aa" is the active cell value when it should be "Ø-æ-". Any
ideas on how to get VB to understand the diffrence of a capital
letter? Thanks!

Thanks for the input with teh Selection.Replace etc.. but that didn't
do anything diffrent.
 
Works for me.
Are you sure ActiveCell is pointing to the correct cell that contains such
chars ?

NickHK

What about setting the MatchCase argument to True?

NickHK


Hey,

Interesting problem...How do I go about doing this? I need Excel to
understand the value of capitalized letters and not automatically
replace based on its value... Take a look at code below.

Sub Eng_to_code

Application.ScreenUpdating = False
ActiveCell.Replace What:="A", Replacement:="Ø"
ActiveCell.Replace What:="a", Replacement:="-æ-"

End Sub

Sub Code_to_Eng

Application.ScreenUpdating = False
ActiveCell.Replace What:="Ø", Replacement:="A"
ActiveCell.Replace What:="-æ-", Replacement:="a"

End Sub

The problem is the code automatically makes the value of the cell into
"ØØ" if "Aa" is the active cell value when it should be "Ø-æ-". Any
ideas on how to get VB to understand the diffrence of a capital
letter? Thanks!

Nick,

Tried the following... and still had no resolution. The screen
flickers but it doesn't do anything more...maybe I'm missing
something? Thanks for the help man!

Sub Eng_to_code()
Application.ScreenUpdating = False
ActiveCell.Replace What:="A", Replacement:="Ø", MatchCase:=True
ActiveCell.Replace What:="a", Replacement:="-æ-", MatchCase:=True
End Sub


Sub Code_to_Eng()
Application.ScreenUpdating = False
ActiveCell.Replace What:="Ø", Replacement:="A", MatchCase:=True
ActiveCell.Replace What:="-æ-", Replacement:="a", MatchCase:=True
End Sub
 
Works for me.
Are you sure ActiveCell is pointing to the correct cell that contains such
chars ?

NickHK











Nick,

Tried the following... and still had no resolution. The screen
flickers but it doesn't do anything more...maybe I'm missing
something? Thanks for the help man!

Sub Eng_to_code()
Application.ScreenUpdating = False
ActiveCell.Replace What:="A", Replacement:="Ø", MatchCase:=True
ActiveCell.Replace What:="a", Replacement:="-æ-", MatchCase:=True
End Sub

Sub Code_to_Eng()
Application.ScreenUpdating = False
ActiveCell.Replace What:="Ø", Replacement:="A", MatchCase:=True
ActiveCell.Replace What:="-æ-", Replacement:="a", MatchCase:=True
End Sub- Hide quoted text -

- Show quoted text -

ActiveCell = The right cell...Ill try absolute refrencing but I'm
using Excel 2003 so I don't know if that makes a diffrence? The code's
logic make sense but it's not doing what I need it to do. I ran some
code that did Application.Calculation = xlManual earlier...could this
be messing it up?
 
ActiveCell = The right cell...Ill try absolute refrencing but I'm
using Excel 2003 so I don't know if that makes a diffrence? The code's
logic make sense but it's not doing what I need it to do. I ran some
code that did Application.Calculation = xlManual earlier...could this
be messing it up?- Hide quoted text -

- Show quoted text -

OK great! Figure it out...Excel just needed a swift kick in the butt.
(Had to reboot Excel). It works great! Thanks alot Nick and Doug!
 
The selection part was unimportant actually - it's the "MatchCase := True"
that you need. That's telling Excel to search in a case-sensitive manner.

You could try turning on the macro recorder and doing the search the way you
want - be sure to check the "Match Case" option - and see what you get. It
should look similar to what Nick and I have suggested.

hth,

Doug

Selection.Replace What:="A", Replacement:="Ø", MatchCase:=True

hth,

Doug


Hey,

Interesting problem...How do I go about doing this? I need Excel to
understand the value of capitalized letters and not automatically
replace based on its value... Take a look at code below.

Sub Eng_to_code

Application.ScreenUpdating = False
ActiveCell.Replace What:="A", Replacement:="Ø"
ActiveCell.Replace What:="a", Replacement:="-æ-"

End Sub

Sub Code_to_Eng

Application.ScreenUpdating = False
ActiveCell.Replace What:="Ø", Replacement:="A"
ActiveCell.Replace What:="-æ-", Replacement:="a"

End Sub

The problem is the code automatically makes the value of the cell into
"ØØ" if "Aa" is the active cell value when it should be "Ø-æ-". Any
ideas on how to get VB to understand the diffrence of a capital
letter? Thanks!

Thanks for the input with teh Selection.Replace etc.. but that didn't
do anything diffrent.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top