View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
K Dales[_2_] K Dales[_2_] is offline
external usenet poster
 
Posts: 1,163
Default Macro to remove ";"

Function SemiClean(MyStr As String) As String
Dim NewStr As String

NewStr = Replace(MyStr, ";;", ";")
If Mid(NewStr, 1, 1) = ";" Then NewStr = Right(NewStr, Len(NewStr) - 1)
If Right(NewStr, 1) = ";" Then NewStr = Left(NewStr, Len(NewStr) - 1)
If InStr(NewStr, ";;") Then NewStr = Clean(NewStr)
SemiClean = NewStr

End Function

"JA" wrote:

My field CombMod in huge database contains entries with
unnecessary semi colons in different places. I need a
macro to remove them.

For Eaxmple
;PM;;;LE;;;;; to become PM;LE

;PM;;PP PL;PP OP;PP PK;;;;;;QM to become PM;PP PL;PP
OP;PP PK;QM

Please help