ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   udf to convert <any text to range name (https://www.excelbanter.com/excel-programming/344904-udf-convert-any-text-range-name.html)

David

udf to convert <any text to range name
 
Greetings,
Has anyone got a ready made UDF to convert say "2goa(T)" to "_goa_T_"
TIA
--
David

Roger Govier

udf to convert <any text to range name
 
Hi David

Not a UDF but a formula
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"2","_"),")", "_"),"(","_")
--
Regards

Roger Govier


"David" wrote in message
...
Greetings,
Has anyone got a ready made UDF to convert say "2goa(T)" to "_goa_T_"
TIA
--
David




Bob Phillips[_6_]

udf to convert <any text to range name
 
'---------------------------------------------------------------------
Function ReFormat(Inp As String) As String
'---------------------------------------------------------------------
Dim oRegExp As Object

Set oRegExp = CreateObject("VBScript.RegExp")
With oRegExp
.Global = True
.Pattern = "[\\0-9(){}\[\]\ £\$%^&*]"
ReFormat = .Replace(Inp, "_")
End With
End Function



--

HTH

RP
(remove nothere from the email address if mailing direct)


"David" wrote in message
...
Greetings,
Has anyone got a ready made UDF to convert say "2goa(T)" to "_goa_T_"
TIA
--
David





All times are GMT +1. The time now is 12:00 AM.

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