Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default Change dollar amount to a negative if another colum has a "P"

I have numbers in a colum that I want to change to a negative(PAID) amount if
there is a "P" in the next column. I need to be able to enter numbers so I
cannot place a formula in the numbers column.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Change dollar amount to a negative if another colum has a "P"

Marvin

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 1 Then
N = Target.Row
If Excel.Range("A" & N).Value < "" _
And Excel.Range("B" & N).Value = "P" Then
Excel.Range("A" & N).Value = Excel.Range("A" & N).Value * -1
End If
End If
enditall:
Application.EnableEvents = True
End Sub

Event Code entered into the sheet module.

Will change the numbers to negative as you enter them in column A if column B
has a "P".

Right-click on sheet tab and "View Code".

Paste into that module.


Gord Dibben Excel MVP

On Mon, 26 Sep 2005 16:49:05 -0700, Marvin
wrote:

I have numbers in a colum that I want to change to a negative(PAID) amount if
there is a "P" in the next column. I need to be able to enter numbers so I
cannot place a formula in the numbers column.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default Change dollar amount to a negative if another colum has a "P"

you might try the following and then make adjustments as needed:

If ALL of the numbers are currently +, the following will find the "P's" and
change the numbers to neg. Warning: if you run this again it will again
reverse the signs.
Adjust accordingly.

Sub FindPmts()
Dim Amts As Range
Dim oCell As Range

Set Amts = Range("A1:A100")
For Each oCell In Amts
If UCase(oCell.Offset(0, 1)) = "P" Then
oCell = oCell * -1
End If
Next
End Sub

"Marvin" wrote:

I have numbers in a colum that I want to change to a negative(PAID) amount if
there is a "P" in the next column. I need to be able to enter numbers so I
cannot place a formula in the numbers column.

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
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
change the colour of the "invert if negative" option in Excel Luci Charts and Charting in Excel 1 May 10th 07 01:48 PM
Sum dollar amount if it has an "S" next to it. Wayne Excel Discussion (Misc queries) 3 March 6th 07 03:38 PM
How do I change "." to "," so e.g. 1.000 = 1,000 in the same colum Tracy Excel Discussion (Misc queries) 3 April 11th 06 12:49 PM
How do I enter a negative dollar amount? CML Excel Discussion (Misc queries) 7 February 6th 05 11:19 PM


All times are GMT +1. The time now is 10:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"