Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Hard line break displaying as rectangle on import from SQL

Hi,
Am pulling data from a company db via SQL and the hard line breaks in
several fields are coming is as that annoying little rectangle. Result is
that the report is pages and pages longer than it has to be. When try to use
the Replace function, Excel does not recognize the character. Any ideas on
how to control this short of going through the entire data set manually?

Thanks much for any ideas,
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Hard line break displaying as rectangle on import from SQL

use a macro:

Sub FixData
Cells.Replace What:=chr(10), _
Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, _
MatchCase:=False
End sub

if these are line return characters the could be Chr(10), chr(13) or both.

I would run the above. If some or all still remain, then replace the
chr(10) with chr(13) and run it again

If they are still there, then you will need to figure out what the character
is.

this can be done with a formula

=code(Mid(a1,12,1))
would give you the ascii code (chr number) for the 12 character in cell A1.

(or you could check that first before running the macro).

Obviously do testing on a copy of your data.

--
Regards,
Tom Ogilvy



"Martha" wrote:

Hi,
Am pulling data from a company db via SQL and the hard line breaks in
several fields are coming is as that annoying little rectangle. Result is
that the report is pages and pages longer than it has to be. When try to use
the Replace function, Excel does not recognize the character. Any ideas on
how to control this short of going through the entire data set manually?

Thanks much for any ideas,

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Hard line break displaying as rectangle on import from SQL

this can be done with a formula

For the OP see also
http://www.cpearson.com/excel/CellView.htm

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Tom Ogilvy" wrote in message ...
use a macro:

Sub FixData
Cells.Replace What:=chr(10), _
Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, _
MatchCase:=False
End sub

if these are line return characters the could be Chr(10), chr(13) or both.

I would run the above. If some or all still remain, then replace the
chr(10) with chr(13) and run it again

If they are still there, then you will need to figure out what the character
is.

this can be done with a formula

=code(Mid(a1,12,1))
would give you the ascii code (chr number) for the 12 character in cell A1.

(or you could check that first before running the macro).

Obviously do testing on a copy of your data.

--
Regards,
Tom Ogilvy



"Martha" wrote:

Hi,
Am pulling data from a company db via SQL and the hard line breaks in
several fields are coming is as that annoying little rectangle. Result is
that the report is pages and pages longer than it has to be. When try to use
the Replace function, Excel does not recognize the character. Any ideas on
how to control this short of going through the entire data set manually?

Thanks much for any ideas,



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
How do I insert a hard break (alt enter) in a concatenated string Alphafiction Excel Discussion (Misc queries) 5 February 24th 07 08:11 PM
Replacing a hard line break in Excel a_ryan1972 Excel Discussion (Misc queries) 4 October 25th 06 09:28 PM
Break cell into multiple lines by line break Chia Excel Discussion (Misc queries) 1 August 20th 06 06:37 AM
line break / hard return? jd Excel Discussion (Misc queries) 3 February 13th 06 07:01 AM
Hard Page Break Dottie Excel Worksheet Functions 2 January 12th 05 11:56 PM


All times are GMT +1. The time now is 03:52 PM.

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

About Us

"It's about Microsoft Excel"