Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Excel: Self-updating cell

Hi,

Is there a way to make a cell so when a user puts 7 to a cell and it
automatically changes to 0.7 by multiplying 0.1 to the value it has
received and show the result in the same cell?

I thought I might be able to utilize the data validation functionality
but couldn't get it to work.

Thanks in advance,
Chan

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 274
Default Excel: Self-updating cell

Maybe this (to be put in the sheet's code module):

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If IsNumeric(Target) And Target.HasFormula = False Then
Target.Value = 0.1 * Target.Value
End If
Application.EnableEvents = True
End Sub

*******************

I wrote it so that if *the user* enters a number then that number is
automatically multiplied by 0.1 but that if a formula changes the
value of a cell then that value is left alone.

Hope that helps

-John Coleman


On Apr 13, 10:04 am, wrote:
Hi,

Is there a way to make a cell so when a user puts 7 to a cell and it
automatically changes to 0.7 by multiplying 0.1 to the value it has
received and show the result in the same cell?

I thought I might be able to utilize the data validation functionality
but couldn't get it to work.

Thanks in advance,
Chan



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 274
Default Excel: Self-updating cell

I just noticed how in your post you talked about wanting a *cell* with
this property. If you want to restrict to a single cell (say A1) , no
problem - just check the address of the Target in the If statement
(note the dollar signs):

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If IsNumeric(Target) And Target.HasFormula = False _
And Target.Address = "$A$1" Then
Target.Value = 0.1 * Target.Value
End If
Application.EnableEvents = True
End Sub



On Apr 13, 11:31 am, "John Coleman" wrote:
Maybe this (to be put in the sheet's code module):

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If IsNumeric(Target) And Target.HasFormula = False Then
Target.Value = 0.1 * Target.Value
End If
Application.EnableEvents = True
End Sub

*******************

I wrote it so that if *the user* enters a number then that number is
automatically multiplied by 0.1 but that if a formula changes the
value of a cell then that value is left alone.

Hope that helps

-John Coleman

On Apr 13, 10:04 am, wrote:



Hi,


Is there a way to make a cell so when a user puts 7 to a cell and it
automatically changes to 0.7 by multiplying 0.1 to the value it has
received and show the result in the same cell?


I thought I might be able to utilize the data validation functionality
but couldn't get it to work.


Thanks in advance,
Chan- Hide quoted text -


- Show quoted text -



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Excel: Self-updating cell

Hi John,

Thank you so much for your reply.
I haven't tested the code yet but it looks to me it will work.

Thanks again,
Chan

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
cell with formula is not automatically updating - Excel Office 200 Robert C Excel Worksheet Functions 2 February 16th 10 01:41 AM
CELL UPDATING Bala Excel Worksheet Functions 3 December 29th 07 04:39 PM
Updating a cell JonathanW Excel Discussion (Misc queries) 1 March 22nd 07 03:31 AM
updating a cell value Ray H. Excel Discussion (Misc queries) 2 February 2nd 06 03:55 AM
Updating the Sum of a cell Teddy54 Excel Worksheet Functions 2 November 18th 05 09:12 PM


All times are GMT +1. The time now is 07:59 AM.

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

About Us

"It's about Microsoft Excel"