跳到主要内容

如何在Excel中将鼠标悬停在特定形状上?

在许多情况下,您需要将宏分配给某种形状,以便在工作表中单击它来运行宏。 将宏分配给形状后,将鼠标悬停在提示上可以帮助您提醒形状将来使用。 本文介绍了两种在Excel中将鼠标悬停到特定形状的方法。

通过添加超链接将鼠标悬停在提示上以达到特定形状
使用VBA代码将鼠标悬停在笔尖上达到特定形状


通过添加超链接将鼠标悬停在提示上以达到特定形状

您可以使用ScreenTip将超链接添加到工作表中的特定形状。 请执行以下操作。

1.右键单击您需要在鼠标上方添加鼠标的形状,然后单击 超链接 从右键单击菜单中。 看截图:

2.在 插入超链接 对话框中,单击 屏幕提示 按钮。 而在 设置超链接屏幕提示 对话框中,输入在鼠标悬停在形状上时需要显示的屏幕提示文本。 最后点击 OK 按钮。 看截图:

3.返回到 插入超链接 对话框中,单击 书签 按钮。 然后在“单元格引用”框中的“类型”中输入A1 选择放置在文档中 对话框,最后单击 OK 按钮。

4。 点击 OK 按钮在 插入超链接 对话框以完成超链接的创建。

现在,您可以看到鼠标悬停在形状上方时显示的屏幕提示。


使用VBA代码将鼠标悬停在笔尖上达到特定形状

运行以下VBA代码后,您可以轻松地将鼠标悬停在尖端上的特定形状。

1.打开工作表,其中包含将鼠标移至上方时显示的形状。 右键单击工作表选项卡,然后从上下文菜单中单击“查看代码”。

2.在 Microsoft Visual Basic应用程序 窗口,请将下面的VBA代码复制到“代码”窗口中。

VBA代码1:将鼠标悬停在笔尖上达到特定形状

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Updated by Extendoffice 2018/3/30
    If Target.Address = Range("A1").Address Then
        Call MoveRow
    End If
End Sub

3。 点击 插页 > 模块。 然后在“模块”窗口中输入以下VBA代码。

VBA代码2:将鼠标悬停在笔尖上达到特定形状

Sub Text()
'Updated by Extendoffice 2018/3/30
    Dim xShape As Shape
    Dim xRg As Range
    On Error Resume Next
    Application.EnableEvents = False
    Set xShape = ActiveSheet.Shapes("Rectangle 4")
    If Not xShape Is Nothing Then
        ActiveSheet.Hyperlinks.Add xShape, "", "A1", ScreenTip:="Click to run Macro "
    End If
    If ActiveSheet.Hyperlinks(1).SubAddress = "A1" Then
        Call MoveRow
    End If
    Application.EnableEvents = True
End Sub

:

1)。 请替换“点击运行宏“和”矩形4”与您的屏幕提示文字和特定形状的名称。
2)。 取代“移动行“ 排队 ”致电MoveRow”(已分配给形状的宏名称)

3。 按 F5 键来运行代码。 然后,将指定的屏幕提示立即添加到特定形状。


相关文章:

最佳办公生产力工具

🤖 Kutools 人工智能助手:基于以下内容彻底改变数据分析: 智能执行   |  生成代码  |  创建自定义公式  |  分析数据并生成图表  |  调用 Kutools 函数...
热门特色: 查找、突出显示或识别重复项   |  删除空白行   |  合并列或单元格而不丢失数据   |   不使用公式进行四舍五入 ...
超级查询: 多条件VLookup    多值VLookup  |   跨多个工作表的 VLookup   |   模糊查询 ....
高级下拉列表: 快速创建下拉列表   |  依赖下拉列表   |  多选下拉列表 ....
列管理器: 添加特定数量的列  |  移动列  |  切换隐藏列的可见性状态  |  比较范围和列 ...
特色功能: 网格焦点   |  设计图   |   大方程式酒吧    工作簿和工作表管理器   |  资源库 (自动文本)   |  日期选择器   |  合并工作表   |  加密/解密单元格    按列表发送电子邮件   |  超级筛选   |   特殊过滤器 (过滤粗体/斜体/删除线...)...
前 15 个工具集12 文本 工具 (添加文本, 删除字符,...)   |   50+ 图表 类型 (甘特图,...)   |   40+ 实用 公式 (根据生日计算年龄,...)   |   19 插入 工具 (插入二维码, 从路径插入图片,...)   |   12 转化 工具 (小写金额转大写, 货币兑换,...)   |   7 合并与拆分 工具 (高级组合行, 分裂细胞,...)   |   ... 和更多

使用 Kutools for Excel 增强您的 Excel 技能,体验前所未有的效率。 Kutools for Excel 提供了 300 多种高级功能来提高生产力并节省时间。  单击此处获取您最需要的功能...

产品描述


Office Tab 为 Office 带来选项卡式界面,让您的工作更加轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,发布者,Access,Visio和Project。
  • 在同一窗口的新选项卡中而不是在新窗口中打开并创建多个文档。
  • 每天将您的工作效率提高50%,并减少数百次鼠标单击!
Comments (8)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Convert your shape to an image. Images have tool tips.
This comment was minimized by the moderator on the site
Doesn't work..... if there is a hyperlink associated with the shape then the macro will not run....
This comment was minimized by the moderator on the site
Dear Niall,
Sorry for the mistake. Please try as below to solve the problem.

Step 1:
In the worksheet contains the shape you will display tip, right click the sheet tab and select View Code from the context menu. And then copy below VBA into the Code window:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = Range("A1").Address Then
Call MoveRow
End If
End Sub

Step 2:
Open the Module code window, copy below code into the Module window.
Please change "MoveRow" in the line Call MoveRow to the macro name you assigned to the shape, and then press the F5 key to run the code.
Thank you for your comment.

Sub Text()
Dim xShape As Shape
Dim xRg As Range
On Error Resume Next
Application.EnableEvents = False
Set xShape = ActiveSheet.Shapes("Rectangle 1")
If Not xShape Is Nothing Then
ActiveSheet.Hyperlinks.Add xShape, "", "A1", ScreenTip:="Click to run Macro "
End If
If ActiveSheet.Hyperlinks(1).SubAddress = "A1" Then
Call MoveRow
End If
Application.EnableEvents = True
End Sub
This comment was minimized by the moderator on the site
Dear Niall,
The code works well in my case. Can you provide your Office version? Thank you for your comment.
This comment was minimized by the moderator on the site
Hello, Sub Test() On Error Resume Next Dim xShape As Shape Set xShape = ActiveSheet.Shapes("Rectangle 4") If Not xShape Is Nothing Then _ ActiveSheet.Hyperlinks.Add xShape, "", "", ScreenTip:="Click to run Macro " End Sub Thank code works great, but it removes Assigned macro. When i use Screen Tip and press on shape Macro Deosn't work. Is any way to fix that? Use Screen tip on shape and keep macro working? Thank youĄ
This comment was minimized by the moderator on the site
Dear Evaldas,
Sorry for the mistake. Please try as below to solve the problem.

Step 1:
In the worksheet contains the shape you will display tip, right click the sheet tab and select View Code from the context menu. And then copy below VBA into the Code window:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = Range("A1").Address Then
Call MoveRow
End If
End Sub

Step 2:
Open the Module code window, copy below code into the Module window.
Please change "MoveRow" in the line Call MoveRow to the macro name you assigned to the shape, and then press the F5 key to run the code.
Thank you for your comment.

Sub Text()
Dim xShape As Shape
Dim xRg As Range
On Error Resume Next
Application.EnableEvents = False
Set xShape = ActiveSheet.Shapes("Rectangle 1")
If Not xShape Is Nothing Then
ActiveSheet.Hyperlinks.Add xShape, "", "A1", ScreenTip:="Click to run Macro "
End If
If ActiveSheet.Hyperlinks(1).SubAddress = "A1" Then
Call MoveRow
End If
Application.EnableEvents = True
End Sub
This comment was minimized by the moderator on the site
I wish someone would solve this problem.
This comment was minimized by the moderator on the site
Good Day,
Please try as below to solve the problem.

Step 1:
In the worksheet contains the shape you will display tip, right click the sheet tab and select View Code from the context menu. And then copy below VBA into the Code window:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = Range("A1").Address Then
Call MoveRow
End If
End Sub

Step 2:
Open the Module code window, copy below code into the Module window.
Please change "MoveRow" in the line Call MoveRow to the macro name you assigned to the shape, and then press the F5 key to run the code.
Thank you for your comment.

Sub Text()
Dim xShape As Shape
Dim xRg As Range
On Error Resume Next
Application.EnableEvents = False
Set xShape = ActiveSheet.Shapes("Rectangle 1")
If Not xShape Is Nothing Then
ActiveSheet.Hyperlinks.Add xShape, "", "A1", ScreenTip:="Click to run Macro "
End If
If ActiveSheet.Hyperlinks(1).SubAddress = "A1" Then
Call MoveRow
End If
Application.EnableEvents = True
End Sub
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations