I found a function on this site that will strip the characters from a string and just leave the numbers. I would like to use variables as the object of the function. My current macro is finding different areas of my spreadsheet that I need to strip off unwanted characters. What I would like to do is use "Item" as my column location and "Rowid" as my row location and store the resulting outcome in Column "AM"+"Rowid. In this example they are specifically Item=2 and Rowid=7 (B7). When I run this it returns 27 in cell "AM7", which is understandable because of the current values of the variables. How do I format the StripChar line to allow me to use the variables? Thank you.
Range("AM" & Rowid).Select
ActiveCell = StripChar(Item & Rowid)
Function StripChar(Txt As String) As String
With CreateObject("VBScript.RegExp")
.Global = True
.Pattern = "\D"
StripChar = .Replace(Txt, "")
End With
End Function
Range("AM" & Rowid).Select
ActiveCell = StripChar(Item & Rowid)
Function StripChar(Txt As String) As String
With CreateObject("VBScript.RegExp")
.Global = True
.Pattern = "\D"
StripChar = .Replace(Txt, "")
End With
End Function