Reputation: 39
I am new to Excel forms and was wondering if someone could help with a simple code for a program I am trying to create for work. Basically, to make my job easier!
What I'm looking for is code that when a specific checkbox is selected and I hit a copy button, it copies a specific cell. I will have multiple checkboxes but just one copy button. Any help would be greatly appreciated!
Upvotes: 0
Views: 2640
Reputation: 378
this assumes your copy button is named CopyButton it will copy cell A1 if a check box named CheckBox1 is checked A2 if CheckBox2 is checked etc you can change the cell references below you didn't really specify what to do with the copied data so it just copies it and does nothing
Public Sub CopyButton_Click()
if(CheckBox1.Value = true) then
ActiveSheet.Range("A1").copy
end if
if(CheckBox2.Value = true) then
ActiveSheet.Range("A2").copy
end if
'copy the chunk above for more check boxes
End Sub
Upvotes: 1