3 replies
by nikki96
Sure.
This script replaces anything between the two dollar signs with whatever you specify as "replacement". The variable str1 is hard-coded here, but you could easily make it a table cell or some such.
Tested in Excel 2000
HTH
Nikki
Public Sub changeIt()
Dim str1, str2 As String
Dim i1, i2 As Integer
Dim replacement As String
replacement = "Z"
str1 = "Workbook1!$U$56"
str2 = ""
MsgBox ("string1 is " & str1 & vbLf & "string2 is " & str2)
i1 = InStr(str1, "$")
i2 = InStrRev(str1, "$")
str2 = str1 & Left(str1, i1) & replacement & Right(str1, Len(str1) - i2 + 1)
MsgBox ("string1 is " & str1 & vbLf & "string2 is " & str2)
End Sub
by cbdepadua
by cbdepadua
This discussion is closed to new replies.
Trending Web Development posts
Sort by Trending