Copy and paste data upon click

Closed
bharathjb29 Posts 3 Registration date Tuesday February 13, 2018 Status Member Last seen February 15, 2018 - Updated on Feb 13, 2018 at 12:09 PM
 Blocked Profile - Feb 15, 2018 at 04:56 PM
I have a set of data on A2 to A10. When I hit cell A2 which contain the word "January", the data will be copied into B2.

If I hit cell A3 which contain the word "March", then the data will be copied into B2

If anyone have suggestion for this???
Related:

2 responses

Blocked Profile
Feb 13, 2018 at 05:06 PM
Please understand we are volunteers. We help when you are stuck.

In this case, you need to understand the IF statement.

The syntax for IF is:
=IF(logic_test,True,False)


So, in cell B2, place your IF code. If the logic test is true, then the True will be presented.

Let us know if you get stuck on this homework, which is what this sounds like.
1
bharathjb29 Posts 3 Registration date Tuesday February 13, 2018 Status Member Last seen February 15, 2018
Feb 14, 2018 at 12:13 PM
Actually I used below code error

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean))
If Intersect(Target, Range("A2:A10")) Is Nothing Then
Exit Sub
Target.Copy Destination:= range("B2")
End Sub
0
A cleaner way would be 1 liner:

 If Intersect(Target, Range("A2:A10")) Is Nothing Then Exit Sub 


Your code does not qualify the entry, so any value in any of those will FIRE your routine. You specifically asked to qualify when a value is there, and your entry does not do that! I am confused!


Have fun.
0
bharathjb29 Posts 3 Registration date Tuesday February 13, 2018 Status Member Last seen February 15, 2018
Feb 15, 2018 at 02:48 PM
Sorry its not working....
0
Blocked Profile
Feb 15, 2018 at 04:56 PM
What isn't working?
0