excel-2007记录宏

发布于 2024-07-27 03:21:32 字数 217 浏览 1 评论 0原文

我只是想知道为什么 Excel-2007 记录宏不写入任何内容,例如当我执行以下操作时:

我在工作表上插入一个矩形并更改其背景色...

(另一方面,如果我在Excel-2003我得到了一些代码。)

另外,是否可以使用VB要求Excel将矩形放在指定位置; 例如我当前的活动单元格是 A10:C10

我希望我的矩形的左上角位于该位置,即 A10:C10

I just wanted to know why Excel-2007 record macro does not write anything for example when I do the following:

I insert a rectangle on the sheet and change its backcolor...

(On the other hand, if I do the same thing in Excel-2003 I get some code.)

Also, is it possible to use VB to ask Excel to put the rectangle on specified position; for example my current active cell is A10:C10

I want my rectangle's upper left corner to be on that location, i.e. A10:C10

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

唠甜嗑 2024-08-03 03:21:32

不确定您的第一个问题,但对于第二个问题,请使用单元格的“左”和“上”属性作为矩形的“左”和“上”。 这是VBA:

Dim sht As Worksheet
Set sht = ActiveSheet

Dim rng As Range
Set rng = shtCells(3, 4)
sht.Shapes.AddShape msoShapeRectangle, rng.Left, rng.Top, 30, 40

Not sure about your first question, but as for your second, use the cell Left and Top properties as the Left and Top for the rectangle. This is VBA:

Dim sht As Worksheet
Set sht = ActiveSheet

Dim rng As Range
Set rng = shtCells(3, 4)
sht.Shapes.AddShape msoShapeRectangle, rng.Left, rng.Top, 30, 40
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文