View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Changing cells temp.

Here is the answer I gave you two days ago and again yesterday.

Why don't you breakdown what isn't working for you. It was tested and works
fine as stated below.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo Errhandler
If Target.Count 1 Then Exit Sub
If Target.Column = 2 Or Target.Column = 3 Then

If Len(Trim(Target.Value)) = 0 Then Exit Sub
Application.EnableEvents = False
If Target.Column = 2 And Target.Row Mod 2 = 0 Then
If IsNumeric(Target.Offset(-1, 0)) And _
Not IsEmpty(Target.Offset(-1, 0)) Then
If Target.Offset(-1, 0).Value < 0 Then
Target.Offset(0, 1).Value = _
Target / Target.Offset(-1, 0)
End If
End If
ElseIf Target.Column = 3 And Target.Row Mod 2 = 0 Then
If IsNumeric(Target) Then
Target.Offset(0, -1) = Target.Offset(-1, -1) * _
Target
End If
End If
End If
Errhandler:
Application.EnableEvents = True
End Sub

This assumes your wages row is an even row and your entry will either be in
column B (dollars) or in Column C (percent).

The Sales row will always be an odd row.

So it works on all cells in columns B and C

--
Regards,
Tom Ogilvy

fwday wrote in message
...
I am making a budgeting program. I have sales, I want to budget wages
and markdowns by dollor or pecent. If I have $100,000 dollars in sales
I want to have 2 cells for wages and 2 cells for Markdowns. Sometimes
I want to budget by percent and sometimes by dollar. The only problem
is that if I punch in a dollar amount it changes the formula in that
cell. And if I punch in percent it changes that cell. I want to have
the choice of budgeting by percent or dallars for bolth wages and
Markdowns. How can I make this happen.

Please break down to let me know what is happening in the code.

Also if there is a web sight I can go to to help me break it down would
be great.



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/