我想要创建一个函数,将使用CONCATENATE()
函数将具有使用&符号级联元素的单元格更改为一个。所以,作为一个例子,我想要一个function ="There are "&7&" cats"
的单元替换为=CONCATENATE("There are ",7," cats")
。宏要更改&运算符连接公式= CONCATENATE(a,b,c)
我有我想写的代码的骨架,但我实际上使它工作的麻烦。我认为这将是一个有趣的项目,让我尝试使用VBA,但我很快意识到,即使尝试了所有Google-fu之后,我仍然试图编写此代码。
到目前为止,我有以下几点:
Function fixConcatenate()
'For each cell in range, replace function elements to swap from & operator concatenation to CONCATENATE() function
For Each c In ActiveCell.CurrentRegion.Cells
'Insert "=CONCATENATE(" by replacing existing "="
Range.Replace("=","=CONCATENATE(")
'If "&" exists inside string, ignore it
'Else replace "&" with ","
'End function in cell with ")"
Next
任何帮助将不胜感激!
您在下降这里兔子洞。考虑这对'=“A”“”&“A”是什么,它会返回'A“A'(导致'= CONCATENATE(,”A“,”,,“,”A,“)'' A,A,') –
在这里你是绝对正确的,这需要解决,如果报价是在这个帐户。 – TsTeaTime