Excel不正确地显示学位标志

我有一个工作表,允许用户更改温度单位,有一个下拉框包含“°C”和“°F”,然后我用VBA来完成剩下的工作。

问题是,我有这样的代码:

Dim UnitString As String Set UnitRange = Worksheets("Units of Measure").Cells UnitString = UnitRange(1, 1) MsgBox UnitString 

它给了我“?C”或“?F”

下一个问题,当我打电话时:

 UnitRange(1, 1) = "° C" 

我在那个牢房里得到了“ฐC”。 (ฐ是泰国人物之一)

这些问题打破了我的表的逻辑,任何人都可以帮助我?

问候,Sarun

你可能想在你的VBA例程中使用Unicode。 例如,下面是一个简单的例程,它将单元格格式化为摄氏度:

 Sub centigrade() Const g = "General" dq = Chr(34) cent = " " & ChrW(8451) s = g & dq & cent & dq Selection.NumberFormat = s Selection.Font.Name = "Arial Unicode MS" End Sub