ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How do I remove all text in a cell after a specific character? (https://www.excelbanter.com/excel-worksheet-functions/35138-how-do-i-remove-all-text-cell-after-specific-character.html)

Erik Millerd

How do I remove all text in a cell after a specific character?
 
I have a cell linked to an Access database field. This field contains carrage
returns. I want to display only the data before the 1st carrage return. Is
there a way to do this? Perhaps useing the LEN, LEFT and other functions?
BTW this is in Excle and Access 2000.

moi

I don't know if that will work with a worksheet function because i don't
know how to search for for an enter. With a VBA function it's easier:

Public Function OnlyB4Enter(wCell As String) As String
Dim i, l As Integer
Dim txtResult As String
l = Len(wCell)
i = InStr(1, wCell, vbCrLf, vbTextCompare)
If i 0 Then
txtResult = Left(wCell, (i - 1))
Else
txtResult = wCell
End If
OnlyB4Enter = txtResult
End Function

"Erik Millerd" <Erik schreef in bericht
...
I have a cell linked to an Access database field. This field contains
carrage
returns. I want to display only the data before the 1st carrage return. Is
there a way to do this? Perhaps useing the LEN, LEFT and other functions?
BTW this is in Excle and Access 2000.





All times are GMT +1. The time now is 04:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com