Macro for copy and paste and delete pasted value

Jan Kalop

Active Member
Joined
Aug 3, 2012
Messages
389
Can I have a macro with command that with single click copy value from (A1) and paste it in designated cell (G20) and with double clik delete that pasted value from that designated cell ?
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Can I have a macro with command that with single click copy value from (A1) and paste it in designated cell (G20) and with double clik delete that pasted value from that designated cell ?
Hey Jan!
You can use Toggle button for this purpose and try following code .



VBA Code:
Private Sub ToggleButton1_Click()

If ToggleButton1.Value = True Then
    Range("G20").Select
    ActiveCell.FormulaR1C1 = "=R[-19]C[-6]"
    ActiveWorkbook.Save
    
Else

Range("A5:I26").Select
    Selection.ClearContents
    Range("G20").Select
    ActiveWorkbook.Save
End If
End Sub
 

Attachments

  • Screenshot_1.jpg
    Screenshot_1.jpg
    42.9 KB · Views: 4
  • Screenshot_2.jpg
    Screenshot_2.jpg
    19.1 KB · Views: 3
  • Screenshot_3.jpg
    Screenshot_3.jpg
    24 KB · Views: 3
Upvote 0
Hey Jan!
You can use Toggle button for this purpose and try following code .



VBA Code:
Private Sub ToggleButton1_Click()

If ToggleButton1.Value = True Then
    Range("G20").Select
    ActiveCell.FormulaR1C1 = "=R[-19]C[-6]"
    ActiveWorkbook.Save
   
Else

Range("A5:I26").Select
    Selection.ClearContents
    Range("G20").Select
    ActiveWorkbook.Save
End If
End Sub
so there is nothing what can be done with, beside that
 
Upvote 0

Forum statistics

Threads
1,214,839
Messages
6,121,891
Members
449,058
Latest member
Guy Boot

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top