I have to replace formula text by required IDs(always in column B) depending upon sheet names referred, as example given below also Screenshot of excel attached herewith (required output is highlighted with yellow color)
eg. formula: =Node!A2 * Comp!A2
required output in new cell: [n1] * [c1]
attached screenshots,
EDIT - I have tried following things, 1] Added 1 button on Result sheet 2] On click of it called macro having code as below
Sub Button1_Click()
Dim formulaVal As String
Dim str1 As String
Dim str12 As String
formulaVal = Range("A2").Formula
Debug.Print formulaVal
'MsgBox Range("J2").Value2
str1 = Replace(formulaVal, "!A", "!B")
Debug.Print str1
'ActiveSheet.Range("E2").Formula = strl
ActiveSheet.Range("E2").Formula = "=Node!B2*Comp!B2"
'MsgBox Range("u2").Value
strl2 = Range("E2").Formula
Debug.Print strl2
End Sub
3] After button clicking getting required formula in cell but it is showing error data type mismatch as referred data is as string which is not compatible with formula
Please suggest alternate solution if any