Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Function FindReplace(strOrig As Variant, strOld As String, strNew As String)
'Function to search and replace characters in a string
'-----------------------------------------------------------
' ARGUEMENT DESCRIPTION
' --------------------------------------------------------
' strOrig String in which to
' search/replace.
'
' strOld String you are searching for.
'
' strNew String to replace the searched
' for string.
' --------------------------------------------------------
' EXAMPLE
' --------------------------------------------------------
' MyString = "555.318.6755"
' MyNewString = FindReplace(MyString,".","-")
' (MyNewString is now "555-318-6755")
'-----------------------------------------------------------
Dim intAt As Integer, strAltered As String
'Check for arguements
If IsNull(strOld) Or IsNull(strNew) Then
FindReplace = "ERROR! CHECK ARGUEMENTS!"
Exit Function
End If
'Check for null string
If IsNull(strOrig) Then
FindReplace = Null
Exit Function
End If
'Do function
For intAt = 1 To Len(strOrig)
If Mid(strOrig, intAt, Len(strOld)) = strOld Then
strAltered = strAltered & strNew
intAt = intAt + (Len(strOld) - 1)
Else
strAltered = strAltered & Mid(strOrig, intAt, 1)
End If
Next intAt
FindReplace = strAltered
End Function