Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Transferring of certain cells from one workbk to another

I have this scenario: On cell A1 of workbook A, when the text "Click" is
selected, certain cell from this workbook will be transferred to workbook B.
Is there any possible program that allows this scenario to function?

Ive been trying to troubleshoot the above but cant seem to get it started.
Can anybody help please?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Transferring of certain cells from one workbk to another

Hi

Inset the code below in the codesheet for sheet1 of workbook A. (Rightclick
on the sheet tab and select View code, and paste the code in the sheet which
appears)

The range to copy and the destination can be changed as desired.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim wbA As Workbook
Dim wbB As Workbook

Set wbA = ThisWorkbook
Set wbB = Workbooks("Book2.xls") 'change to desired name

If Target.Address = "$A$1" Then
If Target.Value = "Click" Then
Range("B2:H4").Copy wbB.Sheets("Sheet1").Range("A1")
End If
End If
End Sub

Hopes it helps.

Regars,
Per

"amelia" skrev i meddelelsen
...
I have this scenario: On cell A1 of workbook A, when the text "Click" is
selected, certain cell from this workbook will be transferred to workbook
B.
Is there any possible program that allows this scenario to function?

Ive been trying to troubleshoot the above but cant seem to get it started.
Can anybody help please?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Transferring of certain cells from one workbk to another

Gee, I cant seem to get the result, I do not know where I go wrong in the
code that I've inserted. Condidering that I am not proficient in Excel, I
would just like to check a few things.

1) if i name wbA as section properties. It should then be:
Dim wbsection properties As Workbook

2)Set wbA=ThisWorkbook
ThisWorkbook is the default name or must i change it to a desired name

3)What's the difference between A1 and $A$1?

Thank you once again.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Transferring of certain cells from one workbk to another

Hi

1) wbA is just a variable used to hold a workbook object. It can be named as
desired (without spaces), but then it shall be changed throughout the code.

2) ThisWorkbook is used to make a reference to the workbook holding the
code. You can change it to something like "Set wbA =Workbooks("Book1.xls")".
Assuming the code is in workbook A, I would use my code.

3) The first is a relative referece the other is a absolute reference. In
VBA all addreses are returned as absolute addresses.

As you don't say which cells to copy, and where to paste, I've just used
some cells as example. If ýou need help copying and pasting desired cells,
state the cells.

Hopes it helps
Per

"amelia" skrev i meddelelsen
...
Gee, I cant seem to get the result, I do not know where I go wrong in the
code that I've inserted. Condidering that I am not proficient in Excel, I
would just like to check a few things.

1) if i name wbA as section properties. It should then be:
Dim wbsection properties As Workbook

2)Set wbA=ThisWorkbook
ThisWorkbook is the default name or must i change it to a desired name

3)What's the difference between A1 and $A$1?

Thank you once again.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Transferring of certain cells from one workbk to another

Ohh ok..i understand better now.

Mayb ill specifically re-state my scenario again:
In wbA, when a user click a value(thickness) from range B12 to B59, the
other values(Depth,Area) where Depth, Area is in column A,D respectively from
that particular row where (thickness) has been selected, will be transferred
to wbB where Depth will be inserted in cell C16, Area in N16.

I am not sure if this is possible to be programmed but Thanks for the help
again.

Cheers.


"Per Jessen" wrote:

Hi

1) wbA is just a variable used to hold a workbook object. It can be named as
desired (without spaces), but then it shall be changed throughout the code.

2) ThisWorkbook is used to make a reference to the workbook holding the
code. You can change it to something like "Set wbA =Workbooks("Book1.xls")".
Assuming the code is in workbook A, I would use my code.

3) The first is a relative referece the other is a absolute reference. In
VBA all addreses are returned as absolute addresses.

As you don't say which cells to copy, and where to paste, I've just used
some cells as example. If ýou need help copying and pasting desired cells,
state the cells.

Hopes it helps
Per

"amelia" skrev i meddelelsen
...
Gee, I cant seem to get the result, I do not know where I go wrong in the
code that I've inserted. Condidering that I am not proficient in Excel, I
would just like to check a few things.

1) if i name wbA as section properties. It should then be:
Dim wbsection properties As Workbook

2)Set wbA=ThisWorkbook
ThisWorkbook is the default name or must i change it to a desired name

3)What's the difference between A1 and $A$1?

Thank you once again.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Transferring of certain cells from one workbk to another

Ok there is no click event which can be used, but we can use a
Double_Click or Right_Click event.
Only one of the two first lines shall be used, the other is to be
deleted. Inset the code as described in previous post.

I still assume that values shall be pasted into sheet1 of wbB.


Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel
As Boolean)

Dim wbA As Workbook
Dim wbB As Workbook

Set wbA = ThisWorkbook
Set wbB = Workbooks("Book2.xls") 'change to desired name
Set isect = Intersect(Target, Range("B12:B59"))

If Not isect Is Nothing Then
TargetRow = Target.Row
Cells(TargetRow, "A").Copy _
Destination:=wbB.Sheets("Sheet1").Range("C16")
Cells(TargetRow, "D").Copy _
Destination:=wbB.Sheets("Sheet1").Range("N16")
End If
End Sub

Hopes it helps

Regards,
Per

On 28 Dec., 01:28, amelia wrote:
Ohh ok..i understand better now.

Mayb ill specifically re-state my scenario again:
In wbA, when a user click a value(thickness) from range B12 to B59, the
other values(Depth,Area) where Depth, Area is in column A,D respectively from
that particular row where (thickness) has been selected, will be transferred
to wbB where Depth will be inserted in cell C16, Area in N16.

I am not sure if this is possible to be programmed but Thanks for the help
again.

Cheers.



"Per Jessen" wrote:
Hi


1) wbA is just a variable used to hold a workbook object. It can be named as
desired (without spaces), but then it shall be changed throughout the code.


2) ThisWorkbook is used to make a reference to the workbook holding the
code. You can change it to something like "Set wbA =Workbooks("Book1.xls")".
Assuming the code is in workbook A, I would use my code.


3) The first is a relative referece the other is a absolute reference. In
VBA all addreses are returned as absolute addresses.


As you don't say which cells to copy, and where to paste, I've just used
some cells as example. If ýou need help copying and pasting desired cells,
state the cells.


Hopes it helps
Per


"amelia" skrev i meddelelsen
...
Gee, I cant seem to get the result, I do not know where I go wrong in the
code that I've inserted. Condidering that I am not proficient in Excel, I
would just like to check a few things.


1) if i name wbA as section properties. It should then be:
Dim wbsection properties As Workbook


2)Set wbA=ThisWorkbook
ThisWorkbook is the default name or must i change it to a desired name


3)What's the difference between A1 and $A$1?


Thank you once again.- Skjul tekst i anførselstegn -


- Vis tekst i anførselstegn -


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
transferring cells.. marketing123 Excel Discussion (Misc queries) 2 August 6th 07 06:32 PM
Close specific workbk Junior728 Excel Programming 1 April 16th 07 10:50 AM
How do I jump from the 1st worksht in a workbk 2 the very last shauno Excel Worksheet Functions 3 October 11th 06 09:43 AM
Lookup of Cells and transferring them to make a list Dan Excel Worksheet Functions 5 July 2nd 06 03:35 PM
Open Workbk/Close Workbk Done Asynchronously? SidBord Excel Programming 0 April 29th 04 06:45 PM


All times are GMT +1. The time now is 07:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"