PC Review


Reply
Thread Tools Rate Thread

Boxes in my text

 
 
Adam
Guest
Posts: n/a
 
      24th Jun 2007
Hi

I have imported an address from outlook and pasted it into on cell in
excel. The line of text includes the carriage return boxes.

How can change my code to replace the boxes for a space.

ActiveCell.Offset(0, 1).Select
Selection = .BusinessAddress


Thanks

 
Reply With Quote
 
 
 
 
Chip Pearson
Guest
Posts: n/a
 
      24th Jun 2007
Adam,

First of all, it is better not to Select a cell and then work with
Selection. Instead, work with the cell directly. E.g.,

ActiveCell.Offset(0,1).Value = .BusinessAddress

You can use the Replace function to replace the line break character(s) with
spaces:

ActiveCell.Offset(0,1).Value = Replace(.BusinessAddress, Chr(10), " ")

What value you need with Chr depends on what character (10, 13, or both 10
and 13 together) is in the BusinessAddress string. If you put it in a cell,
you can use my Cell View add-in to see what character(s) is represented by
the box character. E.g.,

Range("A1").Value = .BusinessAddress

and then view the contents of A1 with CellView.
www.cpearson.com/excel/cellview.htm

Or, you could just do two Replace calls.

Dim S As String
S = .BusinessAddress
Replace(Replace(S, Chr(10), " "), Chr(13), " ")
ActiveCell.Offset(0,1).Value = S

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)




"Adam" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi
>
> I have imported an address from outlook and pasted it into on cell in
> excel. The line of text includes the carriage return boxes.
>
> How can change my code to replace the boxes for a space.
>
> ActiveCell.Offset(0, 1).Select
> Selection = .BusinessAddress
>
>
> Thanks
>


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
User Form Text Boxes - Copy format of text boxes NDBC Microsoft Excel Misc 3 2nd Jul 2009 02:02 AM
Setting an array of text boxes equal to individual form text boxes lcaretto Microsoft Excel Programming 6 19th Sep 2008 04:19 PM
Aligning check boxes and text boxes with regular text =?Utf-8?B?c3NiZWxs?= Microsoft Word Document Management 1 28th Mar 2007 02:12 AM
RE: Aligning check boxes and text boxes with regular text =?Utf-8?B?U2ltb24gSm9uZXMgW01TRExd?= Microsoft Word Document Management 0 28th Mar 2007 12:17 AM
Can I hide the text boxes when printing? I used text boxes to ove. =?Utf-8?B?SmF6?= Microsoft Word Document Management 1 24th May 2006 12:29 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:44 AM.