Solved

Worksheet link (not complete worksheet)

Posted on 2011-03-07
7
286 Views
Last Modified: 2012-08-14
how i do the link, but only with the cells that i want and not my entire worksheet? I use the code from Rorya in my past question and works perfect!


This is my past Question:
Hi, i want to know how to create a link between worksheets in the same workbook.

Example: i enter 25 in the sheet1 A1, this automatically appears in sheet2 A1 and if i enter 35 in sheet2 A1 then the value in sheet1 A1 change to 35, any idea?

This cannot be done with a formula
0
Comment
Question by:joyacv2
  • 3
  • 3
7 Comments
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 35057418
What are the cells you want?
0
 
LVL 1

Author Comment

by:joyacv2
ID: 35057499
For example, A1 and D2
0
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 500 total points
ID: 35057536
Then you want something like:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngCell as range
if not intersect(target, range("A1,D2")) is nothing then
   On Error Resume Next
   Application.EnableEvents = False
   for each rngCell in intersect(target, range("A1,D2"))
   Sheets("Sheet2").Range(rngcell.Address).Value = rngcell.Value
   next rngcell
   Application.EnableEvents = True
end if
End Sub

Open in new window


0
Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
LVL 19

Expert Comment

by:akoster
ID: 35057554
to acieve the results as in the example, take these steps :

1) goto the cell A1 in sheet2
2) enter the following contents :

=sheet1!A1

3) press enter

done

If you want to do this for 10 by 10 cells, you can either

    perform this manually cell by cell on sheet2,

    or select the A1 cell on sheet2, hover the mouse cursor above the black dot on the lower right corner of the cell (mouse cursos should now be a 'plus' sign)
    drag the mouse cursor to a range holding all the cells where you want this functionality.
    Note that when you drag the mouse to the right, eg. to cell B1, this cell also links to cell B1 in sheet1 !
0
 
LVL 1

Author Comment

by:joyacv2
ID: 35057572
This will work for many cells, like a3, D5, c7, ect?
0
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 35057581
Yes, as long as the total cell address is under 255 characters. If it's more than that then you would need to build up the range using Union (or rethink what you are doing! ;))
0
 
LVL 1

Author Closing Comment

by:joyacv2
ID: 35057593
Excelent!
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question