Avatar of chris pike
chris pike
Flag for Canada

asked on 

Removing Hyphen from number string using VBA

I had another great expert help me with this one, but I know they are too busy and I don't want to bug them on this one.

Why isn't this code working?

I have two kinds of codes being entered by a user:
DD-03-A    ......AND......      DD03A  

Why isn't this VBA working?

ElseIf nColScan = 10 Then
      '151208 s4p remove hypens
      If Len(sValue) < 5 Then
         sValue = Trim(Replace(sValue, "-", "")) 'remove hypens, trim leading and trailing spaces
      End If
      If Len(sValue) <= 7 Then
      nRowNext = nRowScan + nRowDataSkip 

Open in new window


Thanks Experts
Chris
Microsoft ExcelVB ScriptVBA

Avatar of undefined
Last Comment
Martin Liss

8/22/2022 - Mon