Cells in the formula, for example: "=sum (' [book1. XLSX] sheet1! X18, '[book2. XLSX] sheet2! This A67) ", how to extract the formula of reference, such as the first time to extract the '[book1. XLSX] sheet1! X18, through some methods will be the reference replace '[book5. XLSX] sheet1! A1, then replaced the value assigned to the original formula of the original position, the final result into "=sum (' [book5. XLSX] sheet1! A1, '[book2. XLSX] sheet2! A67)
"Note: the cell formula used in the method of uncertain, may for the sum, also may as +, -, *, N () * 1, and so on
CodePudding user response:
Sub Macro1 ()
'orientation to your actual unit'
Range (" A1 "). Select
'replacement'
ActiveCell. Formula=Replace (ActiveCell. The Formula, "'/book1. XLSX sheet1! X18 ", "' [book5. XLSX] sheet1! A1 ")
'debugging validation'
The Debug. Print ActiveCell. Formula
End Sub
CodePudding user response:
Thank you very much!Have a question want to ask, how could this formula of reference in this out?
CodePudding user response:
There is no ready-made way,Need to parse formula,
CodePudding user response: