Loading
Ozgrid Excel Help & Best Practices Forums

Excel Video Tutorials / Excel Dashboards Reports



Results 1 to 3 of 3

Thread: Returning contents of another cell using VBA

  1. #1
    Join Date
    10th June 2005
    Posts
    2

    Returning contents of another cell using VBA

    I'm trying to figure out how the return the contents of another cell. For example, I want cell B2 to reflect the contents of cell A1 such that if the spreadsheet user changes the contents of cell A1, it show up in B2 as well, and I need to set this up using VBA.

    In excel, if I type "=A1" into cell B2, then whenever the contents of cell A1 is changed by the spreadsheet user, the contents of cell B2 automatically changes as well without running my VBA macro again.

    Using VBA, if I do: cell(B2) = cell(A1)
    cell B2 contains the contents of cell A1, but if the user changes the contents of cell A1, cell B2 does not update to reflect that automatically.

    Thanks for any help you can offer,
    Steve

    Excel Video Tutorials / Excel Dashboards Reports


  2. #2
    Join Date
    29th December 2004
    Location
    Philipp
    Posts
    113

    Re: Returning contents of another cell using VBA

    Use the worksheet change event in the sheet so
    VB:
    If target.address = "$A$2" Then 
        Range("b2").value = Range("a2").value 
    End If 
    
    

    Excel Video Tutorials / Excel Dashboards Reports


  3. #3
    Join Date
    10th June 2005
    Posts
    2

    Re: Returning contents of another cell using VBA

    Thanks, I wasn't familiar with worksheet change events, but I read up on it and think that will do I need. Thanks very much for your help.

    Excel Video Tutorials / Excel Dashboards Reports


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Possible Answers

  1. Returning A Cell Value
    By Ray_n_yellow in forum EXCEL HELP
    Replies: 1
    Last Post: January 29th, 2007, 16:00
  2. Replies: 3
    Last Post: October 23rd, 2005, 10:00
  3. Deleting contents of rows based on cell contents
    By adncmm1980 in forum EXCEL HELP
    Replies: 2
    Last Post: November 22nd, 2004, 17:17
  4. Delete cell contents based on cell contents length
    By jefsboys in forum EXCEL HELP
    Replies: 4
    Last Post: June 13th, 2004, 19:49

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
porno