Sending data from one cell to another

M

Maria

Sorry if this is posted twice-

I would like to have data from one cell get sent to another cell in the same
worksheet. But I don't want to put a formula in the second cell to grab that
data from the first cell. Is this possible?

For example, if I type in my first name in A1, I would like it to
automatically appear in cells A2, A3, and A4. However, I would like to have
the flexibility to type in my last name into A3 and have that then
automatically appear in A4 as well.

Thanks for your time,
Maria
 
G

Gary''s Student

Insert this event macro in the worksheet code area:

rivate Sub Worksheet_Change(ByVal Target As Range)
Dim A1 As Range, A3 As Range, A4 As Range
Dim t As Range, A24 As Range
Set A1 = Range("A1")
Set A3 = Range("A3")
Set A4 = Range("A4")
Set A24 = Range("A2:A4")
Set t = Target
If Intersect(t, Union(A1, A3)) Is Nothing Then Exit Sub
Application.EnableEvents = False
If Intersect(t, A3) Is Nothing Then
A1.Copy A24
Else
A3.Copy A4
End If
Application.EnableEvents = True
End Sub


Because it is worksheet code, it is very easy to install and use:

1. right-click the tab name near the bottom of the window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

To learn more about Event Macros (worksheet code), see:

http://www.mvps.org/dmcritchie/excel/event.htm
 
G

Gord Dibben

Formulas cannot "send" data anywhere.

In A2, A3 and A4 you must have formulas linking to A1 by =A1

But if you overwrite the formula in A3, it no longer is a formula and A4 is
still linked to A1 so can't return what you typed in A3

What you want to occur can only be done through VBA code


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top