|
-
Apr 14th, 2006, 09:53 AM
#1
Thread Starter
Lively Member
unwanted symbol
I am currently exporting data to an excel worksheet.
One of the data consist an address field which when exported to excel, will be in a multi line order. eg.
vba building
22 new york street
new york 122655
but the problem is that beside name of building, address and postal code will appear a square symbol (i'm guessing its becos of the enter key which allows multiline data). tried to do the replace function to replace the square with a blank, but it didnt work, squares still visible.
anyone know how to make the square box dissapear?
 I think I'm starting to like programming, but I'm still far from good
-
Apr 14th, 2006, 10:16 AM
#2
Re: unwanted symbol
You could use the excel CLEAN function, which will remove all non-printable character.
Declan
Don't forget to mark your Thread as resolved.
Take a moment to rate posts that you think are helpful 
-
Apr 14th, 2006, 10:37 AM
#3
Thread Starter
Lively Member
Re: unwanted symbol
could you give me an example where can i put the clean function?
 I think I'm starting to like programming, but I'm still far from good
-
Apr 14th, 2006, 11:09 AM
#4
Re: unwanted symbol
VB Code:
Sub CleanExample()
Dim rngAreaToClean As Range
Dim rngMyCell As Range
'Whatever range you need to clean
Set rngAreaToClean = ThisWorkbook.Worksheets(1).UsedRange
'Loop through each cell
For Each rngMyCell In rngAreaToClean.Cells
With rngMyCell
'Removing non-prinable characters
.Value = Application.WorksheetFunction.Clean(.Value)
End With
Next rngMyCell
End Sub
Declan
Don't forget to mark your Thread as resolved.
Take a moment to rate posts that you think are helpful 
-
Apr 14th, 2006, 01:04 PM
#5
Re: unwanted symbol
Hi Declan,
Thanks for this Great code!
But, I would like to know what the non-printable characters this code will remove?
-
Apr 14th, 2006, 02:42 PM
#6
Re: unwanted symbol
I believe that it will remove all nonprintable characters,
LF, CR NBSP, etc
Declan
Don't forget to mark your Thread as resolved.
Take a moment to rate posts that you think are helpful 
-
Apr 16th, 2006, 04:34 PM
#7
-
May 7th, 2006, 12:15 AM
#8
Re: unwanted symbol
Yes! it happend to me also. How can we get around of this problem.
Is there any equivalent code in vb6? (not using excel)
-
May 7th, 2006, 02:26 AM
#9
Re: unwanted symbol
A carriage return or Enter key is a non-printable character. So when you use Clean it removes the line breaks and it will all appear on one line.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|