Removing Japanese characters from workbook

tvsramesha

New Member
Joined
Aug 12, 2016
Messages
13
Hi All -
Thanks in advance, I'm using OCR conversion and importing into excel, the label from contains Japanese characters apart from alphanumeric(western) characters, want to only clean the Japanese characters, please help me with a macro to remove the Japanese characters(copied below)

Ramesha

[TABLE="width: 913"]
<colgroup><col><col><col span="2"><col><col span="2"><col><col><col><col><col><col></colgroup><tbody>[TR]
[TD]品番 1889816-1[/TD]
[TD][/TD]
[TD]サイズ[/TD]
[TD]胸囲[/TD]
[TD]90[/TD]
[TD]丫 4[/TD]
[TD][/TD]
[TD]品質表示[/TD]
[TD][/TD]
[TD]表地 毛 5 2%[/TD]
[TD][/TD]
[TD]ポリエステル4 8%[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]品番 1889813-1 1[/TD]
[TD]サイズ[/TD]
[TD]胸囲胴囲[/TD]
[TD]94 82[/TD]
[TD]A6 |[/TD]
[TD]品質表不[/TD]
[TD]表地 毛 ん八丨丨丁フニ[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Hi,

The following macro will take the region around A1 (that means that you can not have empty rows and columns) and delete content from cells that are 100% Japanese
Code:
Sub Jap100()
Dim Rng As Range
With CreateObject("vbscript.regexp")
    .Global = True
    .Pattern = "[^\d^\w^\s-\.\,]"
    For Each Rng In Range("A1").CurrentRegion
        Rng = .Replace(Rng, "")
    Next Rng
End With
End Sub

If you prefer to select the area and being able to delete all Japanese caracters (cleaner) , even if some cells are mixed, then use following

Code:
Sub CleanText(ByVal Rng As Range)
    Dim Cell As Range
        
        With CreateObject("vbscript.regexp")
            .Global = True
            .Pattern = "[^\u0020-\u007F]"
            For Each Cell In Rng
                Cell = .Replace(Cell, "")
            Next Cell
        End With
        
End Sub
Sub ToClean()
Call Module1.CleanText(Selection)
End Sub


Source:excelforum
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,880
Messages
6,175,155
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top