Transferring of certain cells from one workbk to another
That worked for me but.. I would like to actually add a few other things into
the code. My bad, I should have explained to you intially. Ive scanned
through the discussion groups but I became confused on which one to use.
Are the below possible to be added into the code:
1) Copy only the value from "section" to "k Joint". I want the fomat(thick
box border and blue fill) in "K Joint" to remain upon copying.
2) Both the sheets are protected. Is there anyway that the values can still
be transferred?
3) I have 3 Joints in 3 separate sheets: "K Joint", "T Joint" and "N Joint".
Example in "K Joint"--- cell A16: chord, A17:Brace1, A18:Brace2. If the user
wants to select the section size for chord, he will click the word--chord,
which is hyperlinked to "section" sheet. Upon selecting the section size from
the "section" sheet, (the code that had been written previously), it wil
automatically return to "K Joint". So, if the user now wants to select the
section size for Brace1 and Brace2, the same procedure happens.
The same procedure also happens if the user now wants to select the section
size for "T Joint" and "N Joint".
Thanks a million.
"Per Jessen" wrote:
Sure it can be done.
This worked for me:
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.Range("C16")
Cells(TargetRow, "C").Copy Destination:=sh1.Range("E16")
Cells(TargetRow, "G").Copy Destination:=sh1.Range("G16")
End If
End Sub
Regards,
Per
"amelia" skrev i meddelelsen
...
Hi Per,
I would just like to check if it's possible to write a code for the
scenario
I have mentioned previously? Awaiting your reply. Thanks again.
"Per Jessen" wrote:
That error indicate that the sheet don't exist in the active workbook.
Check
for typo's.
Regards,
Per
"amelia" skrev i meddelelsen
...
Thank you for your reply. Ive tried as per what you've mentioned but..
I still came by the error below upon double-clicking the ranged cell.
Run-time error '9': Subscript out of range
The line below is highlighted when I want to debug.
Set sh1 = Worksheets("K Joint")
"Per Jessen" wrote:
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 -
|