pulling a hard return from a cell

J

jeff

Hi, KSA,

Here is a short macro which will separate hard returns
(which are in the form carriage return+linefeed, eg.
chr(13)&chr(10)) and put each part in cells to the
right of your selected cell. first, make sure you
have 2 to 8 free columns to the right of your address
column, then highlight the cells in that column and run
the macro. If you want other characters, substitute
for chr(13)&chr(10).

Good luck
jeff

Sub removeCR()
Dim c As Variant
For Each c In Selection
k = 0
x = InStr(1, c.Value, Chr(13) & Chr(10))
While x
If x Then
'MsgBox ("found at " & x)
k = k + 1
If k = 1 Then y = c.Value
c.Offset(0, 1 + k) = Left(y, x - 1)
c.Offset(0, 2 + k) = Right(y, Len(y) - x - 1)
y = c.Offset(0, 2 + k).Value
x = InStr(1, y, Chr(13) & Chr(10))
End If
Wend
Next c
End Sub
-----Original Message-----
I have a spreadsheet that was exported from Outlook. The
address field contains a hard return. It looks like in
Outlook they had a street address, hard return and then
suite number. I need to go through the spread sheet and
pull out everything after the hard return and put in in
another cell. Is this possible without going through each
record?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top