Macro to remove ";"  
Author Message
alwaysalady





PostPosted: Thu Feb 24 07:01:04 CST 2005 Top

Excel Programming >> Macro to remove ";"

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

Excel220  
 
 
KDales





PostPosted: Thu Feb 24 07:01:04 CST 2005 Top

Excel Programming >> 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



> 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
>
>
>
>
>