View Single Post
  #13   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.misc,microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default Changing the contents of a cell... dynamically?

Hi
interesting. One question first: why don't enter the correct numbers
:-). Easy solutions for this (without writing code for each line) could
be:
- is there a 'system' behind these changes (from your example data doe
not like there is, but maybe there is...)
- If you are able tu put the subtraction value in a cell adjacent to
this column, the macro can use this information (you can hide this
column if you like)

So - as Harald wrote - give us some more details what you want to
achieve

Frank

Friendly Indián wrote:
This works great, now what about this scenario. I have a range
of cells, a10-a50 and I want to do this with all the cells, i.e.
a10 - 25, a11 - 30, a12 - 20, etc. how can I do this without a
1000 lines of code. can the cell ref. in code be changed
dynamically, and if so how? thanks.


"Harald Staff" wrote in message
...
Rightclick the sheet tab. Choose "view code". Paste this in:

Private Sub Worksheet_Change(ByVal Target As Range)
With Target(1)
If .Address = "$A$10" Then
If IsNumeric(.Formula) Then
Application.EnableEvents = False
.Value = .Value - 25
Application.EnableEvents = True
End If
End If
End With
End Sub

--
HTH. Best wishes Harald
Followup to newsgroup only please

"Friendly Indián" skrev i melding
...
I am wanting to do something that I don't know if it is
possible. Here is the scenario...

Say cell A10 gets data (numbers) entered into it, for this
example lets say 100, after the focus moves from the cell I want
25 to be automatically subtracted from the number so that it is
actually is 75. How can I do this if it is possible? Thanks.

--

Please reply to newsgroup so we can all learn from you
knowledge.
Private emails will not be answered.

Friendly Indián