ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   help for Visual Basic Find (https://www.excelbanter.com/excel-programming/363242-help-visual-basic-find.html)

Lolly[_2_]

help for Visual Basic Find
 
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.
--
Kittie

Tom Ogilvy

help for Visual Basic Find
 
figure out what the AscW value is an use that with ChrW as your search
target.

--
Regards,
Tom Ogilvy

"Lolly" wrote in message
...
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.
--
Kittie




[email protected]

help for Visual Basic Find
 

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


Tom Ogilvy wrote:
figure out what the AscW value is an use that with ChrW as your search
target.

--
Regards,
Tom Ogilvy

"Lolly" wrote in message
...
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.
--
Kittie



Tom Ogilvy

help for Visual Basic Find
 
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

--
Regards,
Tom Ogilvy

wrote in message
ups.com...

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


Tom Ogilvy wrote:
figure out what the AscW value is an use that with ChrW as your search
target.

--
Regards,
Tom Ogilvy

"Lolly" wrote in message
...
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.
--
Kittie






All times are GMT +1. The time now is 04:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com