简体   繁体   中英

Search 'Checked' CheckBox in Another Excel File using vba macro

My problem I think is quite simple, but since I am new to this excel vba macro, it is quite tricky. To put it simply, I have two excel file.One with "Refresh" Button. Another excel file with several CheckBoxs, with some words and number in different cell same row. So, when I press "Refresh", I only need info only on the 'ticked' Checkbox. And the info will change when I 'untick' the CheckBox, and vice versa.

I put in the sample 1 button (WorkSheet1) and 3 CheckBox (WorkSheet2).
In the code of Button of Worksheet(1) you write:

With Workbooks("Book2")
    Range("A1").Value = .Sheets("Sheet1").checkbox1.Value
    Range("A2").Value = .Sheets("Sheet1").checkbox2.Value
    Range("A3").Value = .Sheets("Sheet1").checkbox3.Value
End With

This code capture the state of Workbooks(2)...
Modify this code you can capture the data you want.
If you want, in every code of chackbox of Worksheet(2) this code:

With Workbooks("Book1")
    .Sheets("Sheet1").Range("A1").Value = CheckBox1.Value
End With

This code write True or False for every CheckBox...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM