If you have buttons or shapes on an Excel  worksheet, you can get their caption text from a worksheet cell, so the text changes, based on a formula. See how to add the button, create its text, then link the button to cell text instead.

如果您在Excel工作表上有按钮或形状,则可以从工作表单元格获取其标题文本,因此该文本会根据公式进行更改。 了解如何添加按钮,创建其文本,然后将按钮链接到单元格文本。

添加工作表按钮 (Add a Worksheet Button)

In this example, the workbook has a macro to show the total amount of an order. There's a button on the worksheet, and you click that to run the macro.

在此的示例工作簿具有一个宏,以显示订单的总额。 工作表上有一个按钮,然后单击它以运行宏。

If you want to add a button, there are commands on the Developer tab, in the Insert menu on the Controls group.

如果要添加按钮,则在“控件”组的“插入”菜单中的“开发人员”选项卡上有命令。

The button in the Form Controls section is easier to use than the ActiveX controls button, and cause fewer problems, from my experience.

根据我的经验,“表单控件”部分中的按钮比ActiveX控件按钮更易于使用,并且所引起的问题更少。

The Form Controls button has an "Assign Macro" command that appears automatically, after you create it. Just choose a macro from the list, and the button is ready to use.

创建窗体控件按钮后,它会自动显示“分配宏”命令。 只需从列表中选择一个宏,该按钮即可使用。

鸽友按钮 (Fancier Buttons)

Those Developer tab buttons are okay (if you like grey), but I like to use an Excel shape instead. Shapes give you more formatting options, so you can make your button stand out on the worksheet.

这些“开发人员”选项卡按钮可以(如果您喜欢灰色),但是我喜欢使用Excel形状。 形状为您提供了更多格式设置选项,因此您可以使按钮在工作表上突出显示。

In the Insert tab of the Excel Ribbon, click Shapes, then choose one of the shapes, and click on the worksheet, where you want to add it.

在Excel功能区的“插入”选项卡中,单击“形状”,然后选择一种形状,然后在要添加形状的工作表上单击。

With the shape selected, you can change its height and width, other formatting options, like the fill colour and outline colour. I like to change the Shape Effects too, and give it a round Bevel, so it looks more "button=y".

选择形状后,您可以更改其高度和宽度以及其他格式设置选项,例如填充色和轮廓色。 我也喜欢更改形状效果,并给它一个圆形的斜角,所以看起来更像“ button = y”。

Then, to make the shape run a macro, right-click on the shape, and assign a macro to run when you click it.

然后,要使形状运行宏,请右键单击该形状,然后分配一个要在单击时运行的宏。

向按钮添加文本 (Add Text to the Button)

To add a caption to a shape "button", just select it, and start typing.

要将标题添加到形状“按钮”,只需选择它,然后开始输入即可。

For this button, I typed "Run the Macro"

对于此按钮,我键入了“运行宏”

格式化按钮文字 (Format the Button Text)

After you add the text, with the button still selected, use the Formatting commands on the Excel Ribbon to make the text look better.

添加文本后,仍然选择按钮,请使用Excel功能区上的“格式设置”命令使文本看起来更好。

I usually centre the text vertically and horizontally, and choose a bigger font size. Change the font colour too, if necessary, to contrast with the shape's fill colour.

我通常将文本垂直和水平居中,并选择更大的字体。 如果需要,也可以更改字体颜色,以与形状的填充色形成对比。

更改按钮文字 (Change the Button Text)

Instead of using static button text though, sometimes it's nice to have a caption that changes, based on the situation on the worksheet.

但是,代替使用静态按钮文本,有时根据工作表的情况更改标题是很好的选择。

In this example, a quantity is entered in cell C1, and customers get a discount if the quantity is greater than 40.

在此示例中,在单元格C1中输入了数量,如果数量大于40,则客户将获得折扣。

The formula in the cell C11, named TotalPrice, calculates the total price of the order.

单元格C11中的公式名为TotalPrice,用于计算订单的总价。

=OrderQty * VLOOKUP(C1,B8:C9,2,TRUE)

= OrderQty * VLOOKUP(C1,B8:C9,2,TRUE)

按钮文字的公式 (Formula for Button Text)

In cell E2, I've added another formula, to check the quantity, and show text based on that amount.

在E2单元格中,我添加了另一个公式来检查数量,并根据该数量显示文本。

=IF(C1<=40,"See price", "See discounted price")

= IF(C1 <= 40,“查看价格”,“查看折扣价”)

If the quantity is 40 or less, cell E2 will show "See price". If the quantity is over 40, the result in cell E2 will mention the discount – "See discounted price"

如果数量为40个或更少,则单元格E2将显示“查看价格”。 如果数量超过40,则单元格E2中的结果将提及折扣–“查看折扣价”

将按钮文本链接到单元格 (Link Button Text to a Cell)

Instead of showing the static text, "Run the Macro", on the button, here's how to use the dynamic text from cell E2:

这里没有显示静态文本,而是在按钮上显示“运行宏”,而是如何使用单元格E2中的动态文本:

  • Click on the button to select it点击按钮选择它
  • Click in the Formula Bar, and type an equal sign:  =

    在编辑栏中单击,然后键入一个等号: =

  • Click on cell E2, which has the text for the button, and press Enter单击单元格E2,其中包含按钮的文本,然后按Enter

NOTE: You might have to reapply some of the formatting after you link the button to the cell.

注意 :将按钮链接到单元格后,您可能必须重新应用某些格式。

Now, it the quantity is changed, the button will show the applicable text in its caption.

现在,更改数量后,按钮将在标题中显示适用的文本。

查看步骤 (See the Steps)

This animated gif gives you a quick look at the steps.

这个动画的gif使您可以快速了解这些步骤。

切换语言 (Switch Languages)

For another example of linking shape text to worksheet cells, see the cereal box text in my "Switch Languages" blog post.

有关将形状文本链接到工作表单元格的另一个示例,请参阅我的“切换语言”博客文章中的谷物框文本 。

First, you select a language from a drop down list.

首先,您从下拉列表中选择一种语言。

That changes the text in the worksheet cells, because INDEX and MATCH formulas find the translations in a lookup table.

这会更改工作表单元格中的文本,因为INDEX和MATCH公式会在查找表中找到翻译。

There is an orange rectangle on the worksheet, with text boxes sitting on top of it. Those text boxes are linked to the worksheet cells.

工作表上有一个橙色矩形,文本框位于其上方。 这些文本框链接到工作表单元格。

For example, the text box at the top is linked to cell B4, which shows "Honey Nut Cheerios", when English is selected.

例如,当选择英语时,顶部的文本框链接到单元格B4,该单元格显示“ Honey Nut Cheerios”。

When the selected language is French, the linked text boxes show the French text from the worksheet cells.

当所选语言为法语时,链接的文本框将显示工作表单元格中的法语文本。

翻译自: https://contexturesblog.com/archives/2019/02/28/excel-button-text-from-worksheet-cell/


http://www.taodudu.cc/news/show-5535861.html

相关文章:

  • 如何在后台打印Excel电子表格
  • excel技巧_老Excel狗学新技巧
  • Excel 功能区界面组成简介
  • excel 连接 mysql_使用 Excel 进行连接 - Azure SQL Database SQL Managed Instance | Microsoft Docs...
  • mysql中为表增加外键_如何在Excel 2013中为符号分配键盘快捷键
  • 如何快速轻松地在Excel中删除空白行和列
  • 在Excel中创建目录
  • 让WPF中的DataGrid像Excel一样可以筛选
  • excel创建下拉列表多选_如何在Excel中创建下拉列表?
  • 【数据结构】蓝警:合众国之辉
  • D3D模板缓存
  • Direct3D模板技术
  • 城市防汛应急管理智慧 Web GIS 可视化平台
  • 模版缓存3
  • Unity 支持的模型格式及详细介绍
  • 芯动联科冲刺科创板:年营收1.7亿 北方电子院与中城创投是股东
  • 剖析中国软件百强
  • 七夕特辑 | 电子书合集 附下载地址
  • 无盘主流服务器 5,HP G5服务器与无盘的配置(证券业)
  • 证券业如何破局发展,用好NLP技术很关键
  • 查询各个班级男生女生个数(case)
  • ubuntu 系统性能提升
  • jdk1.8 HashMap性能提升
  • SpringBoot实战(十七):Redis Pipeline 轻松实现百倍性能提升(续)
  • 《MySQL开发规范》过时了,视图的查询性能提升了一万倍
  • Qt quick性能提升
  • 干货 | Elasticsearch Reindex性能提升10倍+实战
  • 数据库数据处理性能提升技术
  • 【金仓数据库】kingbase ES性能提升之传输压缩
  • 显卡交火支持linux系统吗,显卡交火性能提升多少_显卡交火怎么设置(步骤教程)...

来自工作表单元格的Excel按钮文本相关推荐

  1. 国产Excel开发组件Spire.XLS【转换】教程(5):#/将特定工作表单元格转换为图像

    本节旨在为开发人员提供详细的解决方案,了解如何通过 C#.VB.NET 中的 .NET Excel 组件 Spire.XLS 将特定的工作表单元格转换为图像.这个 Excel 库帮助我们快速将某些 E ...

  2. 为Excel工作表单元格命名的两种方法

    为单元格起一个名字是一个非常好的习惯,这不仅可以帮助用户记忆,而且可以提高工作效率.用户可以有两种方法为单元格命名.选中要命名的单元格,选择"插 入"菜单中的"名称&qu ...

  3. 工作表单元格区域另存为图片

    实例需求:工作表中的表格内容(A1:C8)另存为图片. 这个很难吗?确实不难.一定要用VBA吗?不一定呦.先来看看如下操作,在工作表中选中相应的单元格区域,依次点击[开始]选项卡的[复制]下拉按钮-& ...

  4. vba编程把纯文本转换成html,如何在Excel的单元格中将HTML转换为文本?

    如何在Excel的单元格中将HTML转换为文本? 如下面的屏幕截图所示,如果工作表单元格中存在许多html标记,那么如何在Excel中将它们转换为纯文本? 本文将向您展示两种从Excel单元格中删除所 ...

  5. excel链接隐藏工作表_自动隐藏Excel工作表

    excel链接隐藏工作表 When you build a workbook for other people to use, there might be worksheets that can s ...

  6. 计算机一级excel单元格,在Excel工作表中选择单元格及其内容

    在工作表 (工作表:在 Excel 中用于存储和处理数据的主要文档.也称为电子表格.工作表由排列成行或列的单元格组成.工作表总是存储在工作簿中.)中,您可以选择单元格.区域 (区域:工作表上的两个或多 ...

  7. EXCEL表单元格内特定内容的提取

    EXCEL表单元格内特定内容的提取 今天我给大家介绍在工作中使用excel的一个小技能-单元格字符串特定内容的提取. Excel可以说是我们在工作中用得最频繁的一个办公软件,但是大家是否知道excel ...

  8. 2.5 对工作表进行保护 [原创Excel教程]

    原文:http://coolketang.com/staticOffice/5a97f101ac502e0032eaf40d.html 1. 本节课将为您演示工作表的隐藏和保护.首先点击选择第四页工作 ...

  9. excel中 复制工作表_如何在Excel 2013中轻松移动或复制工作表

    excel中 复制工作表 There may be times when you want to create a new Excel worksheet based on an existing w ...

最新文章

  1. andriod 接入mqtt_Android 连接阿里云 mqtt失败
  2. WindowsPowerShell常用命令
  3. [项目管理]团队管理中的起点:尊重
  4. linux下tomcat服务器的启动和关闭以及查看实时打印日志
  5. Visio绘制时序图
  6. Latex 中插入超链接 插入网址
  7. (一)UI设计的一些常识
  8. GitStats-Git历史统计信息工具(转载)
  9. 微信公众号开发基本流程
  10. 香港长和集团开创P2F金融理财新征程
  11. u8登录找不到服务器,用友u8不能连接到服务器
  12. 不看后悔!圈内老手总结的18条嵌入式 C 实战经验
  13. 邓俊辉数据结构学习心得系列——如何正确衡量一个算法的好坏
  14. JDO:查询你的数据
  15. 2021年中高级Android大厂面试秘籍,为你保驾护航金三银四,直通大厂
  16. 机械硬盘显示拒绝访问要怎样办啊
  17. android虚拟内置sd卡,安卓虚拟器bluestacks虚拟sd卡打开方法【图解】
  18. lol网通区服务器的位置,LOL英雄联盟转区系统地址在哪?
  19. 小程序全局拖动悬浮球插件
  20. 电子书管理软件Calibre使用

热门文章

  1. 【笔记】可能是唯一能让天猫精灵方糖播放本地音乐的智能方案
  2. 手机1像素线粗_iOS绘制1像素线的正确姿势
  3. 【NLP之transformer | Datawhale-9月】Task01:熟悉规则,学习概览
  4. 北漂,2013好好混
  5. Asp.net前端页面开发总结
  6. Assert.isTrue 意思是反的
  7. android 截图root权限,Android Root权限截屏
  8. (免费资源)基于微信小程序的小说阅读系统设计与实现
  9. Statement和Prestatement的区别(转)
  10. hihoCoder-1066-无间道之并查集