输入'='作为单元格中的第一个字符 [英] Entering '=' as the first character in a cell

查看:125
本文介绍了输入'='作为单元格中的第一个字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行的VBA宏,通常需要将=作为单元格中的第一个字符。单元格中填充有=国内,国内等值。



现在我将=替换为IS作为quickfix,但是如果我能保持等号,我希望与使用诸如<>之类的符号的单元一致。当我尝试,Excel认为它是一个错误的语法的函数。我使用 Cells(row,col).Value = x ,其中 x 是可能或不可能的字符串以=开始,输入数据。

解决方案

添加单引号'在字符串的开头:

  Cells(row,col).Value ='& x 

,你会得到你想要的。


I have a VBA macro that runs and often needs to have "=" as the first character in a cell. Cells are filled with such values as "= Domestic", "<> Domestic", etc.

Right now I am replacing "=" with "IS" as a quickfix, but I would like it if I could keep the equal sign, for consistency with cells that use symbols such as "<>". When I try, Excel thinks it is a function with the wrong syntax. I am using Cells(row, col).Value = x, where x is the string that may or may not start with "=", to enter the data.

解决方案

Add a single quote ' at the start of the string:

Cells(row, col).Value = "'" & x

and you will get what you want.

这篇关于输入'='作为单元格中的第一个字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆