Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Macro - Cell reference - (Range)


Hello,

I am using Excel 2002 and I want a Macro to do a cell reference that
referecence data from sheet 2 to sheet 1. For example in sheet 2 the data
would look this:


Sheet 2

A B C D E
1 John 16 18 19 30
2 Joe 22 33 44 55
3 Tom 6 88 99 10
4 Ann 2 99 22 44


Sheet 1 will not be populated at all until the macro is run.

Sheet 1 - Without runing a macro

A B C D E
1
2
3
4

Sheet 1 - After macro is run

A B C D E
1 John 16 18 19 30
2 Joe 22 33 44 55
3 Tom 6 88 99 10
4 Ann 2 99 22 44

Now I know I can do a simple copy and paste, but the user will go back to
sheet 2 and change the name in column A or change the amount in the other
columns. The problem with that is Sheet 1 will not be updated and the user
will forget to run the macro again. I perfer to do a cell reference. Is
there a way I can do this? Any tips or website to go will be appreciated.
Thank you in advance



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Macro - Cell reference - (Range)

why not use use referencing in the sheet. on sheet1, cell A1 has =Sheet2!A1
replicate this right/down.

you could also set the change_event for sheet2 to copy the data to sheet1

Private Sub Worksheet_Change(ByVal Target As Range)
Worksheets("sheet1").Range(Target.Address) = Target.Value
End Sub

This is simplistic. You could amend to copy just the data. Lets say the
table is in A1:E20

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A1:E20")) Is Nothing Then
Worksheets("sheet1").Range(Target.Address) = Target.Value
End If
End Sub



"Alex Martinez" wrote:


Hello,

I am using Excel 2002 and I want a Macro to do a cell reference that
referecence data from sheet 2 to sheet 1. For example in sheet 2 the data
would look this:


Sheet 2

A B C D E
1 John 16 18 19 30
2 Joe 22 33 44 55
3 Tom 6 88 99 10
4 Ann 2 99 22 44


Sheet 1 will not be populated at all until the macro is run.

Sheet 1 - Without runing a macro

A B C D E
1
2
3
4

Sheet 1 - After macro is run

A B C D E
1 John 16 18 19 30
2 Joe 22 33 44 55
3 Tom 6 88 99 10
4 Ann 2 99 22 44

Now I know I can do a simple copy and paste, but the user will go back to
sheet 2 and change the name in column A or change the amount in the other
columns. The problem with that is Sheet 1 will not be updated and the user
will forget to run the macro again. I perfer to do a cell reference. Is
there a way I can do this? Any tips or website to go will be appreciated.
Thank you in advance




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
Reference Range Names in Macro Karin Excel Discussion (Misc queries) 8 August 27th 09 02:32 PM
Cell reference in a range nick Excel Worksheet Functions 5 September 13th 06 06:16 PM
Defining a range using a cell reference jagbabbra Excel Worksheet Functions 5 June 5th 06 01:36 PM
Cell Reference with Range Name SCSC Excel Worksheet Functions 2 March 23rd 06 11:32 PM
use a cell to reference a range in a vlookup Dan Excel Discussion (Misc queries) 4 July 27th 05 07:36 PM


All times are GMT +1. The time now is 06:26 AM.

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

About Us

"It's about Microsoft Excel"