View Single Post
  #15   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
I would use this kind of problem differently (without using the
worksheet_change event). Why don't you use two adjacent cells (one
including the tare weight and one cell automatically calculating the
package weight.). e.g.
A B C
1000 cont_type 975
....
In this case you enter the weight in column A and select the container
type in column B (using a listbox/data validation). The value in column
C is then calculated automatically.

If you like, you can send me your spreadsheet and i#ll setup both
versions (using worksheet change and using two cells)

Frank

Friendly Indián wrote:
This is the reason. At my job I weigh containers (3 different
types), these containers contain packages. Now each contanier
has a different weight (tare), the weight I am interested in is
the actual package weight (the tares are 35, 210 and 466 lbs),
so when I enter a weight in, I want the tare weight to be
subtracted automatically from the cell. I have different
columns for each of the different containers, I then use the
data in a chart. So is there an easy (or pretty easy ) way to
do this? I can include a copy of my datasheet if that would
help to visualize. Thanks a lot!


"Harald Staff" wrote in message
...
25, 30, 20, etc ??? Please explain, this is like the rapid

french course "Horse is Cheval.
And so on."

And what's this for ? Why should someone have to enter 100 to get 75
in a cell ?

Best wishes Harald
Followup to newsgroup only please.

"Friendly Indián" wrote in message
...
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