ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Input cell should display a percentage of input value in the cell (https://www.excelbanter.com/excel-discussion-misc-queries/251219-input-cell-should-display-percentage-input-value-cell.html)

Sherees

Input cell should display a percentage of input value in the cell
 
Please read the below discussion and suggest an answer

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
--
Life isa journey not a destination


"Gary''s Student" wrote:

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

--
Gary''s Student - gsnu200909


"Sherees" wrote:

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
--
Life isa journey not a destination


--
Life isa journey not a destination


All times are GMT +1. The time now is 01:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com