darbar76528
New Member
- Joined
- Sep 2, 2017
- Messages
- 11
Greetings everyone. I have a code that i have running on two sheets of my workbook and they perform great. i am trying to implement the code into a third sheet and i cannot seem to make it work. I have included the 3 macros that i am attempting to implement. The goal is as follows:
1. With the "addcheckboxes" macro, place a checkbox starting in column F12 and continuing down column F to the end of a populated row referencing Column G.
2. When a checkbox is checked, i need for the checkbox click to copy the value of the corresponding column. For instance, if the F14 checkbox is clicked, then the values in G14:K14 would be copied up to G6:K6. Same worksheet.
In other words, if there is a checkbox in column F19 and a person clicked on it, it would copy the value of cells G19:K19 and paste the value into G6:L6
thanks for any help\assistance you can give me!
The sheet name that this code is going in to is "Sheet6" or Start Page
Thanks for any assistance you can offer!
1. With the "addcheckboxes" macro, place a checkbox starting in column F12 and continuing down column F to the end of a populated row referencing Column G.
2. When a checkbox is checked, i need for the checkbox click to copy the value of the corresponding column. For instance, if the F14 checkbox is clicked, then the values in G14:K14 would be copied up to G6:K6. Same worksheet.
In other words, if there is a checkbox in column F19 and a person clicked on it, it would copy the value of cells G19:K19 and paste the value into G6:L6
thanks for any help\assistance you can give me!
The sheet name that this code is going in to is "Sheet6" or Start Page
Code:
Sub Addcheckboxes()
Dim cell, LRow As Single
Dim chkbx As CheckBox
Dim MyLeft, MyTop, MyHeight, MyWidth As Double
Application.ScreenUpdating = False
LRow = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
For cell = 2 To LRow
If Cells(cell, "A").Value <> "" Then
MyLeft = Cells(cell, "$C").Left
MyTop = Cells(cell, "$C").Top
MyHeight = Cells(cell, "$C").Height
MyWidth = Cells(cell, "$C").Width
ActiveSheet.CheckBoxes.Add(MyLeft, MyTop, MyWidth, MyHeight).Select
With Selection
.Caption = ""
.Value = xlOff
.Display3DShading = False
End With
End If
Next cell
Application.ScreenUpdating = True
End Sub
Sub CopyRows()
With Sheet4.CheckBoxes(Application.Caller)
If .Value = xlOn Then
Sheet4.Range("L" & Sheet4.Rows.Count).End(xlUp).Offset(1).Resize(, 2).Value = Sheet4.Range(.TopLeftCell.Address).Offset(, -2).Resize(, 2).Value
.Value = xlOff
End If
End With
End Sub
Sub RemoveCheckboxes()
'Dim chkbx As CheckBox
ActiveSheet.CheckBoxes.Delete
'For Each chkbx In ActiveSheet.CheckBoxes
' chkbx.Delete
'Next
End Sub
Thanks for any assistance you can offer!