View Single Post
  #14   Report Post  
Posted to microsoft.public.excel.programming
Per Jessen[_2_] Per Jessen[_2_] is offline
external usenet poster
 
Posts: 703
Default Transferring of certain cells from one workbk to another

Hi Amelia

Three problems in that statement:

1) The "_" sign shall only be used when you have one statement split
on two or more lines to indicate that it's one statement.

2) You are missing af colon before the equal sign.

3) You have a double sheet reference in the line mentioned,

use either

Cells(TargetRow, "A").Copy Destination := sh1.Range("C16")

or

Cells(TargetRow, "A").Copy Destination:= Sheets("K Joint").Range
("C16")

Hopes this helps

---
Per

On 7 Feb., 13:14, amelia wrote:
Hi Per Jessen,

I'm now trying to transfer the cells from one sheet to another but..

I came by the error below upon double-clicking the ranged cell.
Compile error:method or data member not found.

Error showed at ....sh1.Sheets...under the line below.
Cells(TargetRow, "A").Copy_Destination = sh1.Sheets("K Joint").Range("C16")

Below is the full code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)

Dim sh As Worksheet
Dim sh1 As Worksheet

Set sh = Worksheets("Section Properties")
Set sh1 = Worksheets("K Joint")
Set isect = Intersect(Target, Range("C12:C177"))

If Not isect Is Nothing Then
TargetRow = Target.Row
Cells(TargetRow, "A").Copy_Destination = sh1.Sheets("K Joint").Range("C16")
Cells(TargetRow, "C").Copy_Destination = sh1.Sheets("K Joint").Range("E16")
Cells(TargetRow, "G").Copy_Destination = sh1.Sheets("K Joint").Range("G16")
End If

End Sub

Thanks in advance.



"Per Jessen" wrote:
Thanks for your reply. I'm glad you finally made it work as desired.


Regards,
Per


"amelia" skrev i meddelelsen
...
Hooray!! It works. Thank you for the unconditional help.- Skjul tekst i anførselstegn -


- Vis tekst i anførselstegn -