ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Linking cell A in sheet 1 with several cells in sheet 2 (https://www.excelbanter.com/excel-worksheet-functions/136794-linking-cell-sheet-1-several-cells-sheet-2-a.html)

o0KelviN0o

Linking cell A in sheet 1 with several cells in sheet 2
 
I've got 2 spreadsheets and I wish to link both spreadsheets this way,

1. Cell A belongs to spreadsheet 1
2. The data in Cell A changes daily
3. I wish to import the data in Cell A into spreadsheet 2 daily

Today I key in the number "1" into Cell A, the number "1" is also shown in
spreadsheet 2 row 10.

Tomorrow I delete the number 1 in Cell A and key in a number "2", I want to
have the number "2" shown in row 11 of spreadsheet 2, without affecting row
10

How can I do that?

Thank You so much :)

Kathrine

Linking cell A in sheet 1 with several cells in sheet 2
 
Copy/paste the following code to the code section of your input worksheet:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim c As Range

' A1 is your input cell - change to suit
If Target.Address = "$A$1" Then
' Mylist is your destination range - change name to suit
For Each c In Application.Range("Mylist")
If c.Value = "" Then
Application.EnableEvents = False
c.Value = Target.Value
Application.EnableEvents = True
Exit For
End If
Next c
End If
End Sub

This should work
Kathrine


"o0KelviN0o" wrote:

I've got 2 spreadsheets and I wish to link both spreadsheets this way,

1. Cell A belongs to spreadsheet 1
2. The data in Cell A changes daily
3. I wish to import the data in Cell A into spreadsheet 2 daily

Today I key in the number "1" into Cell A, the number "1" is also shown in
spreadsheet 2 row 10.

Tomorrow I delete the number 1 in Cell A and key in a number "2", I want to
have the number "2" shown in row 11 of spreadsheet 2, without affecting row
10

How can I do that?

Thank You so much :)



All times are GMT +1. The time now is 09:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com