0

I am using VBA to manipulate a dataset and ahve run into a problem; I need to write some values to cells but keep them as strings rather than numbers so later filters will work with other database data.

I was using Cell.Value = x which does the job but is there a way of getting it to write with a string?

I have a feeling this has a simple answer but my google-fu is weak.

4

1 回答 1

3

考虑

1)将单元格格式化为文本(右键单击“格式化单元格”可用)

2)用Cell.Value = "'" & CStr(x)

我更喜欢(1),因为它将数据与表示分离;总是好的编程习惯。

于 2013-07-02T14:48:57.143 回答