单元格下拉框实现复选框多选_将复选框链接到带有宏的单元格

单元格下拉框实现复选框多选

You can use check boxes on a worksheet, and link the results to a cell. If the box is checked, the cell shows TRUE, and if it’s not checked, the cell shows FALSE or the cell is empty. This makes it easy for someone to give a quick answer to a question, or select an option. You can even link check boxes to cells with a macro, so something happens automatically when the box is clicked.

您可以使用工作表上的复选框,并将结果链接到单元格。 如果选中该框,则该单元格显示TRUE,如果未选中,则该单元格显示FALSE或该单元格为空。 这使某人可以轻松地快速回答问题或选择一个选项。 您甚至可以使用宏将复选框链接到单元格,因此单击该复选框时,某些操作会自动发生。

两部分教程 (Two Part Tutorial)

This will be a two part tutorial on how to link check boxes to a macro.

这将是一个分为两部分的教程,介绍如何将复选框链接到宏。

  1. First, we’ll set up the check boxes, and link them to cells. You’ll see how to do this manually, and with a macro.

    首先,我们将设置复选框,并将其链接到单元格。 您将看到如何使用宏手动执行此操作。
  2. In the next part, we’ll link check boxes to cells with a macro.

    在下一部分中,我们将复选框链接到带有宏的单元格。

创建待办事项清单 (Creating a To Do List)

To see how the check boxes can be used, we’ll set up a To Do list, with a check box for each item. Here is the list, ready for the check boxes.

要查看如何使用复选框,我们将设置一个“待办事项”列表,其中每个项目都有一个复选框。 这是清单,准备使用复选框。

checkboxtodolist01

插入复选框 (Insert a Check Box)

To insert a check box, follow these steps:

要插入一个复选框,请按照下列步骤操作:

  • Click the Developer tab on the Ribbon. If you don’t see the Developer tab, follow the inst

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Excel 三级 联动 下拉框 代码 实例 代码注释 先在第一个下拉框加入一个valiation, 内容是 =$A$2:$A$5 Private Sub Worksheet_Change(ByVal Target As Range) ' Call back function which defined within according worksheet Dim i As Integer Dim tempStr As String Dim firstDrawBoxRowCount As Integer Dim firstDrawBoxColumn As Integer firstDrawBoxRowCount = 4 'Define the row number of first draw box firstDrawBoxColumn = 1 'Define the column number of ifrst draw box Dim secondDrawBoxRowCount As Integer Dim secondDrawBoxColumn As Integer secondDrawBoxRowCount = 33 'Define the row number of second draw box secondDrawBoxColumn = 4 'Define the column number of second draw box If Target.Column = 1 Then 'This defines the first column of draw box list, you can also define the row number of draw box list Cells(Target.Row, Target.Column + 1) = "" ' Do the clean first Cells(Target.Row, Target.Column + 1).Validation.Delete Cells(Target.Row, Target.Column + 2) = "" Cells(Target.Row, Target.Column + 2).Validation.Delete For i = 2 To firstDrawBoxRowCount + 1 'Enter the cycle to find out the content for column 2 If Trim(Cells(Target.Row, Target.Column)) = Trim(Cells(i, firstDrawBoxColumn)) Then tempStr = Trim(Cells(i, firstDrawBoxColumn + 1)) 'Find out the options for second draw box, it is seperated by , Cells(Target.Row, Target.Column + 1).Select ' Fill the validation to second draw box With Selection.Validation .Delete .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _ xlBetween, Formula1:=tempStr .IgnoreBlank = True .InCellDropdown = True .InputTitle = "" .ErrorTitle = "" .InputMessage = "" .ErrorMessage = "" .IMEMode = xlIMEModeNoControl .ShowInput = True .ShowError = True

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值