help for Visual Basic Find

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I am trying to develop a macro. I need to do do a find in Japanese Kanji.
(Double byte). Whenever I do copy and paste from excel sheet to Visual Basic
editor that kanji character changes to "??". Could any one help me for
searching a double byte character in VBA, Rest all words are in English.

Any help would be higly appreciated.

Thanks in advance.
 
figure out what the AscW value is an use that with ChrW as your search
target.
 
Hi,
Tom

Thanks for the reply. I have the value for AscW.It's "8d87" and "8C76".
I wanted to find these values in excel sheet and then replace next two
cells by blank .

If you could help me on this further I would appreciate it.
Here are my codes.
Set rng1 = Range("A:B").Find(What:="* ??", _
After:=rng, _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchByte:=True)
If Not rng1 Is Nothing Then
sAddr = rng1.Address
Do
If rng1.Column = 1 Then
rng1.Offset(0, 1).Resize(, 3).ClearContents
ElseIf rng1.Column = 2 Then
rng1.Offset(0, -1).ClearContents
rng1.Offset(0, 1).Resize(, 3).ClearContents
End If
Set rng1 = Range("A:B").FindNext(rng1)
Loop While rng1.Address <> sAddr
End If


Thanks a lot
 
I don't have anything to test it on, but my suggestion was:

c& = clng("&H" & "8d87")
Set rng1 = Range("A:B").Find(What:=ChrW(c&), _
After:=rng, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchByte:=True)
If Not rng1 Is Nothing Then
sAddr = rng1.Address
Do
If rng1.Column = 1 Then
rng1.Offset(0, 1).Resize(, 3).ClearContents
ElseIf rng1.Column = 2 Then
rng1.Offset(0, -1).ClearContents
rng1.Offset(0, 1).Resize(, 3).ClearContents
End If
Set rng1 = Range("A:B").FindNext(rng1)
Loop While rng1.Address <> sAddr
End If
 

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

Back
Top