Someone on this forum was kind enough to help me with this code, I have follow up questions, but he is in New Zealand and it's saturday morning and I don't expect him to wake up and head straight to this forum. Project is almost due. I am stuck
The macro works well. If you click on the checkbox, the cell contents are copied and pasted from column k to column m and back. I want to be able to click and copy and paste data from columns I, J, K and back, and even from columns that are not next to each other. I cant figure it out. I keep getting compiler errors. I attached a dummy file of my work. It is in Excel 2007
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
' this is column A to double click for simulated checkbox action
Const ActionCol = 2
With Target
If .Column = ActionCol Then
Cancel = True
With Application
.EnableEvents = False
.ScreenUpdating = False
End With
With .Font
.Name = "Wingdings 2"
.Size = 13
End With
If .Value = "£" Then ' if unchecked do this
.Value = "T"
Cells(.Row, "K").Copy
Cells(.Row, "M").PasteSpecial xlPasteValues
Cells(.Row, "K").ClearContents
Else ' if checked or blank do this
.Value = "£"
Cells(.Row, "M").Copy
Cells(.Row, "K").PasteSpecial xlPasteValues
Cells(.Row, "M").ClearContents
End If
With Application
.EnableEvents = True
.ScreenUpdating = True
End With
End If
End With
End Sub
Thank you very much
this is the important part.
If .Value = "£" Then ' if unchecked do this
.Value = "T"
Cells(.Row, "K").Copy
Cells(.Row, "M").PasteSpecial xlPasteValues
Cells(.Row, "K").ClearContents
Else ' if checked or blank do this
.Value = "£"
Cells(.Row, "M").Copy
Cells(.Row, "K").PasteSpecial xlPasteValues
Cells(.Row, "M").ClearContents
Thank you for your help!
Bookmarks