trouble with functions

  • Thread starter Thread starter cxs00u
  • Start date Start date
C

cxs00u

Hi,

I am fairly new to excel and I am trying to get to grip with the
workings of functions.

Is there a way to make a function execute everytime I input a value
into a box ?

For example I want to be able to subtract 50 from a value ( in B4)
everytime I enter a value ( in A4).

At the moment I can get the function to work once but not repeatedly.

I hope that makes sense

Thank you in advance

Craig
 
Hi,



With a function, it's not possible but with a Macro you could do that. You
said that you are new to Excel, What I give you is more advance. Here is the
code. Put it in the module of the Sheet. To get at the module do:

Tools > Macro > Macros. > Visual basic editor

Double click on the sheet name, in the project window, to the right in witch
you want the code. If the project window is not visible, Use the menu View >
Project Explorer



Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = "$A$4" Then

Range("b4").Value = Range("b4").Value - 50

End If

End Sub
 

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