Macros

  • Thread starter Thread starter RobertLees
  • Start date Start date
R

RobertLees

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

Any ideas ?

Thanks
Rober
 
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"
in message
news:[email protected]...
 
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
 

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

Back
Top