+ Reply to Thread
Results 1 to 3 of 3

Macros

  1. #1
    Registered User
    Join Date
    08-24-2005
    Posts
    11

    Macros

    When a value is entered into, say, cell B5, I want that value to be added to, say, E5. I could do this by attaching a macro to a shortcut key, or preferably when the cell loses focus.

    Any ideas ?

    Thanks
    Robert

  2. #2
    Chip Pearson
    Guest

    Re: Macros

    Robert,

    Put the following code in the code module for the appropriate
    worksheet.

    Private Sub Worksheet_Change(ByVal Target As Range)

    If Target.Address = "$B$5" Then
    Application.EnableEvents = False
    Range("E5").Value = Range("E5").Value + Target.Value
    Application.EnableEvents = True
    End If

    End Sub


    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com





    "RobertLees"
    <[email protected]> wrote
    in message
    news:[email protected]...
    >
    > When a value is entered into, say, cell B5, I want that value
    > to be
    > added to, say, E5. I could do this by attaching a macro to a
    > shortcut
    > key, or preferably when the cell loses focus.
    >
    > Any ideas ?
    >
    > Thanks
    > Robert
    >
    >
    > --
    > RobertLees
    > ------------------------------------------------------------------------
    > RobertLees's Profile:
    > http://www.excelforum.com/member.php...o&userid=26580
    > View this thread:
    > http://www.excelforum.com/showthread...hreadid=533208
    >




  3. #3

    Re: Macros

    if you wanted a range in a column to be added to E5, like b5, then b6,
    then b7, etc, how would you change the procedure?

    John


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1