how can we enter at the same time maintain a formula in a cell?

S

Sherees

Is it possible that when we enter a number in a cell, the same cell should
display the entered number after deducting certain percentage. This macro
should run automatically when the excel file is open
 
G

Gary''s Student

Put this event macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim r As Range
Set r = Range("B9")
If Intersect(r, Target) Is Nothing Then Exit Sub
Application.EnableEvents = False
r.Value = 0.75 * r.Value
Application.EnableEvents = True
End Sub

If you enter a value in cell B9, it will automatically be reduced to 75% of
the typed value.

Because it is worksheet code, it is very easy to install and use:

1. right-click the tab name near the bottom of the window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

To learn more about Event Macros (worksheet code), see:

http://www.mvps.org/dmcritchie/excel/event.htm
 
S

Sherees

Many thanks for ur answer
what if i want to change B1:B700(but want to leave one cell for sum total in
every 8 cells down), similarly in C1:C700, & D1: D700
 

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

Top