LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default making a cell fixed number to a input number

The Dollars and the Percents are 2 diffrent cells. Its just that
sometimes I want to put in a percent and sometimes a dollar. For
example. in cell A1 is a dollar amount. In the Cell A2 is the dollar
amount of the pecentage of Cell B2. If I cange B2 it will change the
dollar amount. Then if I go back to A2 and put in a dollar amount the
formula for the equasion will be gone. I don't want it be be gone I
just want it to be in the background and change the percent amount.

I am sending an attachment so that you may understand what I am looking
for. I am making a worksheet to budget off of. Sometimes you budget by
dollars and sometimes you budget by percent. B7 is the sales. B8 is the
Wages. And C8 is the percent of wages. I want to have the option to
punch in the percent of wages that I am looking for or the dollars of
wages. If I make a typed change in cell B8 wages I want the C8 percent
to change. If I punch in the C8 percnet I want the wages to change.
This will give the flexiblity to budget eather way.

Here is a copy of the code that I got that worked. It worked fine. I
just don't know how to get it to work on many diffrent situations on
one sheet. You can only do one sheet_change in a page. How do I do this
for many diffrent places on one sheet?

paste in code like this

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo Errhandler
If Target.Count 1 Then Exit Sub
If Not Intersect(Target, Range("B8:C8")) Is Nothing Then
If Len(Trim(Target.Value)) = 0 Then Exit Sub
Application.EnableEvents = False
If Target.Address = "$B$8" Then
Debug.Print 1
If IsNumeric(Target.Offset(-1, 0)) And _
Not IsEmpty(Target.Offset(-1, 0)) Then
Debug.Print 2
If Target.Offset(-1, 0).Value < 0 Then
Debug.Print 3
Target.Offset(0, 1).Value = _
Target / Target.Offset(-1, 0)
End If
End If
Else
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

File Attached: http://www.excelforum.com/attachment.php?postid=331791 (example.xls)

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

 
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
copying cell links with fixed number in between OverlookingSimpleClue Excel Worksheet Functions 3 March 17th 08 10:00 AM
countif with cell ref vs fixed number... griff Excel Discussion (Misc queries) 5 February 18th 08 11:07 AM
Addding a Random number to a fixed number..... Dermot Excel Discussion (Misc queries) 6 August 20th 06 12:17 PM
How can i specify a cell to have a fixed number of characters john dunford Excel Discussion (Misc queries) 1 January 30th 06 10:08 PM
Rounding a number to a multiple quantity that adds to a fixed total number wjlo Excel Worksheet Functions 1 November 9th 04 04:43 PM


All times are GMT +1. The time now is 09:47 PM.

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"