Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sam Sam is offline
external usenet poster
 
Posts: 4
Default getting rid of unprintable chraracters...?

I have the following loop in a function to get rid of unprintable
chararcters (car ret, line feeds, etc) in a cell.
It works fine most of the time, but something is getting by it.
I keep running into a cell that has one char that always remain (I can
see it is taking up a space, but I cannot identify it).

Can I change this loop to leave only a-z A-Z 0-9?
Or at the very least, leave only chracters I can see?
Thnak you

Function eliminate_unprintable_chars(chars)
For i = 1 To Len(chars)
If Mid(chars, i, 1) " " Then
...I have a good character here, now save it....
End If
Next i
End Function

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default getting rid of unprintable chraracters...?

The ascii code for " " is 32, so you are eliminating anything below 32 but
not above - and there are some very odd characters above the alphabet. 122
is "z" and above that are the strange things, although you might want 123-126
as well ("{","|","}","~" in Arial font). This would do that:
If Asc(Mid(chars, i, 1)) 32 And Asc(Mid(chars, i, 1))<126 Then...
--
- K Dales


"Sam" wrote:

I have the following loop in a function to get rid of unprintable
chararcters (car ret, line feeds, etc) in a cell.
It works fine most of the time, but something is getting by it.
I keep running into a cell that has one char that always remain (I can
see it is taking up a space, but I cannot identify it).

Can I change this loop to leave only a-z A-Z 0-9?
Or at the very least, leave only chracters I can see?
Thnak you

Function eliminate_unprintable_chars(chars)
For i = 1 To Len(chars)
If Mid(chars, i, 1) " " Then
...I have a good character here, now save it....
End If
Next i
End Function


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 903
Default getting rid of unprintable chraracters...?

Hi Sam,
Take a look at the comments in
http://www.mvps.org/dmcritchie/excel/join.htm#trimall
and also at the topic above that to find out what you actually have.
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"K Dales" wrote in message ...
The ascii code for " " is 32, so you are eliminating anything below 32 but
not above - and there are some very odd characters above the alphabet. 122
is "z" and above that are the strange things, although you might want 123-126
as well ("{","|","}","~" in Arial font). This would do that:
If Asc(Mid(chars, i, 1)) 32 And Asc(Mid(chars, i, 1))<126 Then...
--
- K Dales


"Sam" wrote:

I have the following loop in a function to get rid of unprintable
chararcters (car ret, line feeds, etc) in a cell.
It works fine most of the time, but something is getting by it.
I keep running into a cell that has one char that always remain (I can
see it is taking up a space, but I cannot identify it).

Can I change this loop to leave only a-z A-Z 0-9?
Or at the very least, leave only chracters I can see?
Thnak you

Function eliminate_unprintable_chars(chars)
For i = 1 To Len(chars)
If Mid(chars, i, 1) " " Then
...I have a good character here, now save it....
End If
Next i
End Function





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can you make an Excel Worksheet unprintable ibvalentine Excel Discussion (Misc queries) 2 March 9th 07 01:31 AM
How can I delete unprintable characters using VBA in Excel? peterv[_5_] Excel Programming 3 September 28th 05 07:13 PM


All times are GMT +1. The time now is 01:23 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"