Special character (copied from Word to Excel)

UHsoccer

Well-known Member
Joined
Apr 3, 2002
Messages
1,023
I copied a word document into Excel and need to process it with VB

I need to remove special characters that do not display in Excel. In word when I turn on the display of hidden characters they display as a little circle with a line pointing outward from the circle at 45, 135, 225 and 316 degrees. They are all in table cells.

I have tried to display it in the screen but was unable to do so.

Any help is appreciated
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Hi UHsoccer

Have you tried the CLEAN function?

If A1 has nonprintable characters

=CLEAN(A1)

Hope this helps
PGC
 
Upvote 0
That seems to remove it from the spreadsheet.

Is there an equivalent function in VB to accomplish that?
 
Upvote 0
Richard,

I am using the follwing code
Code:
For cur = 1 To 200   '  for the end
        Application.WorksheetFunction.Clean (Range("A" & cur))
        If Len(Trim(Range("A" & cur))) = 0  Then GoTo delRow
        GoTo nextRow  '  row not to be deleted
next cur

Once finished, I copied the content of cell A ro word and the strange characters are still there.
 
Upvote 0
Update, here is the full text

Clean: Removes all nonprintable characters from text. Use CLEAN on text imported from other applications that contains characters that may not print with your operating system. For example, you can use CLEAN to remove some low-level computer code that is frequently at the beginning and end of data files and cannot be printed
 
Upvote 0
Hi

I think you'll need to amend to:

Code:
For cur = 200 To 1 Step -1   '  for the end
        Range("A"&cur).Value = Application.WorksheetFunction.Clean (Range("A" & cur).Value)
        If Len(Trim(Range("A" & cur))) = 0  Then GoTo delRow
        GoTo nextRow  '  row not to be deleted
next cur

Best regards

Richard
 
Upvote 0

Forum statistics

Threads
1,214,632
Messages
6,120,652
Members
448,975
Latest member
sweeberry

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