Hi,
I have had moderate sucess with my first few attempts at implementing vba code but I am still struggeling a bit here and I cant tell how advanced this problem may become to solve.
In the below table I am trying to create a macro(s) that will:
1. upon doubleclick in cell of column "fruit", copy and paste that cell into "a1" on "sheet2"
and,
2. upon doubleclick in cell of column "colour", copy and paste that cell into "a1" on "sheet3"
[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD]Fruit
[/TD]
[TD]Coloumn X , Y, Z etc[/TD]
[TD]Colour
[/TD]
[/TR]
[TR]
[TD]Apple[/TD]
[TD][/TD]
[TD]Red[/TD]
[/TR]
[TR]
[TD]Apple[/TD]
[TD][/TD]
[TD]Green[/TD]
[/TR]
[TR]
[TD]Lemon[/TD]
[TD][/TD]
[TD]Yellow[/TD]
[/TR]
[TR]
[TD]Lime[/TD]
[TD][/TD]
[TD]Green[/TD]
[/TR]
[TR]
[TD]Banana[/TD]
[TD][/TD]
[TD]Yellow[/TD]
[/TR]
</tbody>[/TABLE]
The following code solves step 1 only, but my attempts to input the 2nd command alongside it are proving extreamly difficult.
Any help would be greatly appreciated.
Many thanks,
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("a2:a6")) Is Nothing Then
Cancel = True
If Target.Row > 1 And Len(Target.Value) Then Worksheets("sheet2").Range("a1").Value = Target.Value
Worksheets("sheet2").Activate
End If
End Sub
Notes:
*The above code directs you to the worksheet also.
*Assume there are other coloumns (x,y,z) between the 2 in question.
I have had moderate sucess with my first few attempts at implementing vba code but I am still struggeling a bit here and I cant tell how advanced this problem may become to solve.
In the below table I am trying to create a macro(s) that will:
1. upon doubleclick in cell of column "fruit", copy and paste that cell into "a1" on "sheet2"
and,
2. upon doubleclick in cell of column "colour", copy and paste that cell into "a1" on "sheet3"
[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD]Fruit
[/TD]
[TD]Coloumn X , Y, Z etc[/TD]
[TD]Colour
[/TD]
[/TR]
[TR]
[TD]Apple[/TD]
[TD][/TD]
[TD]Red[/TD]
[/TR]
[TR]
[TD]Apple[/TD]
[TD][/TD]
[TD]Green[/TD]
[/TR]
[TR]
[TD]Lemon[/TD]
[TD][/TD]
[TD]Yellow[/TD]
[/TR]
[TR]
[TD]Lime[/TD]
[TD][/TD]
[TD]Green[/TD]
[/TR]
[TR]
[TD]Banana[/TD]
[TD][/TD]
[TD]Yellow[/TD]
[/TR]
</tbody>[/TABLE]
The following code solves step 1 only, but my attempts to input the 2nd command alongside it are proving extreamly difficult.
Any help would be greatly appreciated.
Many thanks,
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("a2:a6")) Is Nothing Then
Cancel = True
If Target.Row > 1 And Len(Target.Value) Then Worksheets("sheet2").Range("a1").Value = Target.Value
Worksheets("sheet2").Activate
End If
End Sub
Notes:
*The above code directs you to the worksheet also.
*Assume there are other coloumns (x,y,z) between the 2 in question.