从另一个工作表中选择一个复选框 [英] Select a CheckBox from another worksheet

查看:198
本文介绍了从另一个工作表中选择一个复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在工作表A上有一个ActiveX复选框控件,另一个在工作表B上有一个控件。当我检查A的复选框时,我希望我的宏检查B的复选框。

I have a ActiveX CheckBox control on worksheet "A" and another on worksheet "B". When I check the CheckBox at "A", I want my macro to check the CheckBox at "B".

到目前为止我已尝试过:

What I have tried so far:

Sheets(B)。形状(CheckBox1)。ControlFormat.Value = xlOn

和此 ThisWorkbook.Worksheets(1).Shapes (复选框1)OLEFormat.Object.Value = 1

两个代码给我一个错误,表示该对象不'

Both codes give me an error saying that the the object doesn't accept this property or method.

所以不可能从另一个工作表中检查一个CheckBox?

So it's not possible to check a CheckBox from another worksheet?

推荐答案

表1中的复选框1更改表格2中的checkbox1

Checkbox1 in sheet 1 to change checkbox1 in sheet 2

Private Sub CheckBox1_Click()
    If Me.CheckBox1 = True Then
        Sheets("Sheet2").CheckBox1.Value = True
    Else
        Sheets("Sheet2").CheckBox1.Value = False
    End If
End Sub

这篇关于从另一个工作表中选择一个复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆