Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
hw
 
Posts: n/a
Default Making a cell Negitive only

Can this be done by formating or do I need a formula. I thought I may be able
to do this using the "IF" function but the examples I've seen only give me
text. I really just want certian cells to have Negitive numeric values only.
I am trying to create a general ledger so certian cells must be negitive to
balance.
Thanks! Ya'll Rock BTW
  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

You could use another cell and a formula:

=-abs(a1)

Or you could use a worksheet event that looks for positive values in that range.

Just rightclick on the worksheet tab that should have this behavior. Select
View code and paste this in the code window:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
With Target
If .Cells.Count 1 Then Exit Sub

If Intersect(Me.Range("a:a"), Target) Is Nothing Then
Exit Sub
End If

On Error GoTo ErrHandler:
If IsNumeric(.Value) Then
If .Value 0 Then
Application.EnableEvents = False
.Value = -Abs(.Value)
Beep 'just to notice
End If
End If
End With

ErrHandler:
Application.EnableEvents = True
End Sub

I used all of column A. Modify it the way you like.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm



hw wrote:

Can this be done by formating or do I need a formula. I thought I may be able
to do this using the "IF" function but the examples I've seen only give me
text. I really just want certian cells to have Negitive numeric values only.
I am trying to create a general ledger so certian cells must be negitive to
balance.
Thanks! Ya'll Rock BTW


--

Dave Peterson
  #3   Report Post  
Ron Rosenfeld
 
Posts: n/a
Default

On Mon, 23 May 2005 13:05:47 -0700, "hw" wrote:

Can this be done by formating or do I need a formula. I thought I may be able
to do this using the "IF" function but the examples I've seen only give me
text. I really just want certian cells to have Negitive numeric values only.
I am trying to create a general ledger so certian cells must be negitive to
balance.
Thanks! Ya'll Rock BTW


How do the numbers get into these cells?

If formula, please post the formula.

If by direct entry, you can either use Data Validation to ensure a negative
number is entered; or you could have an event driven macro which would convert
any positive number entered to a negative one.

Let us know, and a solution will be forthcoming.


--ron
  #4   Report Post  
bj
 
Posts: n/a
Default

try <data<Validation<whole Number<less than 0
select what you want the computer to door say when a positive number is
entered.

"hw" wrote:

Can this be done by formating or do I need a formula. I thought I may be able
to do this using the "IF" function but the examples I've seen only give me
text. I really just want certian cells to have Negitive numeric values only.
I am trying to create a general ledger so certian cells must be negitive to
balance.
Thanks! Ya'll Rock BTW

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
up to 7 functions? ALex Excel Worksheet Functions 10 April 12th 05 06:42 PM
Is there a way of making data imput in to a cell mandatory before. TerryM Excel Worksheet Functions 0 February 15th 05 11:25 AM
Can a Formula in Cell X modify Cell Y? alMandragor Excel Discussion (Misc queries) 7 February 10th 05 09:51 PM
Making comments apply to more than one cell Evelyn Excel Discussion (Misc queries) 2 February 9th 05 12:08 AM
inserting data from a row to a cell, when the row number is specified by a formula in a cell [email protected] New Users to Excel 2 January 6th 05 07:18 AM


All times are GMT +1. The time now is 06:45 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"