[英]Remove = from formula vba
My problem is that i have an excel file where sometimes a "=" is at the beginning of a cell making it a formula for excel. 我的问题是我有一个excel文件,有时在单元格的开头有一个“ =”,使其成为excel的公式。 How can i search for those cells and remove the "="? 我如何搜索那些单元格并删除“ =”?
Thanks in advance! 提前致谢!
You can try something like this: 您可以尝试如下操作:
For Each c in Sheet1.Range("A1:C5").Cells
If Left(c.Formula,1) = "=" Then c.Formula = "'" & c.Formula
Next
Note: above code changes formula to text ;) 注意:以上代码将公式更改为文本;)
A1 => '=Bla bla bla
This should work smoothly and delete all of your "=" in sheet and keep formula visible : 这应该可以顺利进行,并删除工作表中的所有“ =”并保持公式可见:
For Each cell In ActiveSheet.UsedRange
If Left(cell.Formula, 1) <> "=" Then
Else
cell.Formula = "'" & Right(cell.Formula, Len(cell.Formula) - 1)
End If
Next cell
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.