Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 9th, 2005, 06:07 PM
Registered User
 
Join Date: Jun 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Pointer to contents of another cell

I am trying to figure out how to have one cell point to the contents of another cell using VBA. For example, have cell A2 equal the contents of cell A1 such that if the user of the excel spreadsheet changes the contents of A1, cell A2 will automatically reflect that change.

If in excel I type into cell A2: "=A1", then when the contents of A1 changes, A2 automatically changes. That is what I want to accomplish, but with VBA.

Using VBA, if I set A2 = A1, cell A2 is set to the current value of A1, and A2 does not change if the user changes the value of A1.

Hope my description is clear. Any help would be appreciated.

--Steve
 
Old June 10th, 2005, 12:12 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 168
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
You can use worksheets Change event

Private Sub Worksheet_Change(ByVal Target As Range)
    Range("A2") = Range("A1")
End Sub

-vemaju

 
Old June 14th, 2005, 03:51 PM
Registered User
 
Join Date: Jun 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think that will do the trick, thanks very much for your help.





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create a Hyperlink based on Cell Contents chatguy Excel VBA 4 October 15th, 2007 09:43 PM
I need to refer a cell within a cell like =RC[ RC2 chakravarthi_os Excel VBA 1 September 24th, 2006 08:19 AM
How to compare cell contents with a character? danwes Excel VBA 5 June 8th, 2005 11:36 AM
Lose cell Text when editing cell in VSFlexGrid 6 bobcratchet VB How-To 0 July 30th, 2004 09:32 AM
Delet contents of a single cell marmer Classic ASP Basics 1 August 27th, 2003 08:14 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.