ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to remove ";" (https://www.excelbanter.com/excel-programming/323922-macro-remove-%3B.html)

JA[_3_]

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





K Dales[_2_]

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







All times are GMT +1. The time now is 04:46 PM.

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