Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 43
Default how can we enter at the same time maintain a formula in a cell?

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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default how can we enter at the same time maintain a formula in a cell?

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

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 43
Default how can we enter at the same time maintain a formula in a cell

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Enter date and time in cell tankerman Excel Discussion (Misc queries) 4 December 3rd 06 11:42 AM
enter a static time dependent upon another cell value kefee85 Excel Discussion (Misc queries) 2 October 17th 06 06:01 PM
when i enter time in cell it changed, why? Hassan Excel Worksheet Functions 1 June 9th 06 01:38 AM
enter a time into a cell, have the cell show two times the entry johnp Excel Worksheet Functions 3 May 2nd 05 12:08 AM
How do I enter a time formula into a worksheet that determines if. Lee Excel Discussion (Misc queries) 1 February 15th 05 02:03 PM


All times are GMT +1. The time now is 04:34 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"