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
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?
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
address field contains a hard return. It looks like in-----Original Message-----
I have a spreadsheet that was exported from Outlook. The
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?