问题已解决
老师,ctrl+G定位后填充的公式怎么改成文本格式?我用了设置单元格格式改常规和文本都改不过来,之前学的忘记了



首先,Ctrl+G定位后填充的公式要改成文本格式,可以使用excel中的宏功能,即在工具栏上点击“宏”,在“宏”菜单中选择“编辑”,将公式改成文本格式。另外,可以通过宏脚本操作,分别查找公式中的每一部分,然后使用replace函数将其替换为文本格式,如以下代码:
For Each c In Selection
If c.Has Formula Then
c.Value = Application.WorksheetFunction.Substitute(c.Formula, "=", "")
End If
Next c
此外,我们可以使用统计函数把公式的各个部分单独分出来,然后用字符串相加把它们拼接起来,形成我们想要的文本格式。拓展知识:像excel中的宏、VBA脚本,这种文字处理技术也可以应用于word文件,比如word中的宏、VBA脚本等,可以用宏实现文字变换、合并、替换、删除等操作,方便我们快速处理文档。
2023 01/15 13:24