Related:
- Replace naming with actual cell reference
- Replace abbreviation - Guide
- How to replace motherboard battery - Guide
- Replace siri with chat gpt - Home - IOS
- Ikea naming system - Home - Apps & Sites
- Conditional formatting if cell contains text ✓ - Excel Forum
2 responses
I think that question was self-explanatory. Unfortunately, the best I could come up with is what I have below. The limitation is that it won't convert names in other workbooks (e.g. 'AnotherWorkbook.xls!foo') to cell references, but it's still better than other solutions I've seen, including the TransitionFormEntry "trick", which only converts names from the same worksheet to cell references. The example below only converts the formula in the ActiveCell, but you can add code to loop thru all cells with formulas in the workbook.
Dim myRegExp As RegExp
Dim newEqn As String
Dim nm As Name
Set myRegExp = New RegExp
With myRegExp
.Global = True
.IgnoreCase = False
End With
newEqn = ActiveCell.Formula
For Each nm In ActiveWorkbook.Names
With nm
If InStr(1, .RefersTo, "#REF!") = 0 Then
myRegExp.Pattern = "([\=\+\-\*/\^\,\(\)<>\[\]])(" & .Name & ")([\+\-\*/\^\,\(\)<>\[\]]?)"
newEqn = myRegExp.Replace(newEqn, "$1" & Replace(Right(.RefersTo, Len(.RefersTo) - 1), "$", "$$") & "$3")
End If
End With
Next nm
sharpman
Posts
1021
Registration date
Saturday 23 May 2009
Status
Contributor
Last seen
20 October 2010
183
25 Aug 2009 à 13:28
25 Aug 2009 à 13:28
example of data and what you are trying to do?