Copy and paste data upon click

bharathjb29 3 Posts Tuesday February 13, 2018Registration date February 15, 2018 Last seen - Feb 13, 2018 at 06:19 AM - Latest reply: ac3mark 8846 Posts Monday June 3, 2013Registration dateModeratorStatus February 23, 2018 Last seen
- 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???
See more 

5 replies

Reply to this topic
ac3mark 8846 Posts Monday June 3, 2013Registration dateModeratorStatus February 23, 2018 Last seen - Feb 13, 2018 at 05:06 PM
+1
Helpful
1
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.
bharathjb29 3 Posts Tuesday February 13, 2018Registration date February 15, 2018 Last seen - 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
Respond to ac3mark
ac3mark 8846 Posts Monday June 3, 2013Registration dateModeratorStatus February 23, 2018 Last seen - Updated by ac3mark on 14/02/18 at 04:32 PM
0
Helpful
2
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.
bharathjb29 3 Posts Tuesday February 13, 2018Registration date February 15, 2018 Last seen - Feb 15, 2018 at 02:48 PM
Sorry its not working....
ac3mark 8846 Posts Monday June 3, 2013Registration dateModeratorStatus February 23, 2018 Last seen - Feb 15, 2018 at 04:56 PM
What isn't working?
Respond to ac3mark