首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Excel VBA Font.Superscript代码不工作。

Excel VBA Font.Superscript代码不工作。
EN

Stack Overflow用户
提问于 2015-10-01 16:23:31
回答 2查看 307关注 0票数 0

此excel代码不工作。为什么?实际上,我无法使工作任何superscript代码。我使用Excel 2007

注意: intRow和intColumn是决定行和列的整数。

代码语言:javascript
运行
复制
Cells(intRow, intColumn).Characters(Start:=Len(Cells(intRow, intColumn).Value), Length:=1).Font.Superscript = True
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2015-10-01 17:09:26

我发现了问题。它是细胞的format。一定是text

superscript行之前添加该行解决了问题:

代码语言:javascript
运行
复制
Cells(intRow, intColumn).NumberFormat = "@"

谢谢。

票数 2
EN

Stack Overflow用户

发布于 2015-10-01 16:55:51

你需要完全符合你所有的细胞条件。这样做是可行的:

代码语言:javascript
运行
复制
Option Explicit

Public Sub test()
    SuperscriptLastLetter 1, 1
End Sub

Public Sub SuperscriptLastLetter(ByVal lngRow As Long, ByVal lngCol As Long)

    With ActiveSheet.Cells(lngRow, lngCol)

        .Characters(Start:=Len(.Value), Length:=1).Font.Superscript = True

    End With

End Sub

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32892403

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档