Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro to link Excel Checkbox to cell

Status
Not open for further replies.

cas10980

Programmer
Jun 8, 2003
1
US
I have numerous speadsheets each containing many checkboxes from which I need to extract data. I was trying to write a macro that would link a particular checkbox to a cell on a separate worksheet I created to compile the data in that particular workbook.

ActiveSheet.Shapes("Check Box 276").Select
ActiveSheet.Shapes("Check Box 276").Select
With Selection
'.Value = xlOn
.LinkedCell = "supplier_details!$GB$2"
.Display3DShading = False
End With

Note I have commented out the .Value statement.
When running the macro, If the checkbox is checked, TRUE appears in the linked cell as expected, but an unchecked checkbox puts nothing in the cell. I don't want the data changed, I just need to get it into a format I can use.

Any ideas?

Thanks!
 
Your code may be almost there - the cell may not actually be populated until the checkbox state is changed. So. . .

Try adding a couple lines of code after you create the linked cell that test whether the box is checked, then toggle the box to the opposite state and back.

Just a thought!


VBAjedi [swords]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top