Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default negative number

How do i set up that when i exit cell B2 that the number will change to a
negative number??
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default negative number

One way:

Put this in your worksheet code module (right-click the worksheet tab
and choose View Code):

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Cells.Count 1 Then Exit Sub
If .Address(False, False) = "B2" Then
If IsNumeric(.Value) Then
On Error Resume Next
Application.EnableEvents = False
.Value = -.Value
Application.EnableEvents = True
On Error GoTo 0
End If
End If
End With
End Sub


In article ,
enyaw wrote:

How do i set up that when i exit cell B2 that the number will change to a
negative number??

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default negative number

One way is to type a "-" in front of the number just before you move the
cursor. Or you can veiw this site to get some ideas on how to use the
SelectionChange event.

http://support.microsoft.com/kb/213193

"enyaw" wrote:

How do i set up that when i exit cell B2 that the number will change to a
negative number??

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
Converting a negative number to a positive number Barb Excel Discussion (Misc queries) 3 November 1st 07 02:20 AM
Change negative sign from end of number to the beginning of the number. GORDON SCALES via OfficeKB.com Excel Programming 3 January 30th 05 08:05 AM
2003= negative number&2004= negative number How Do I Calculate gro Jason Excel Worksheet Functions 1 January 14th 05 05:24 PM
Compare/match positve number against negative number? Kobayashi[_56_] Excel Programming 2 November 19th 04 09:11 PM
Compare/match positve number against negative number? Kobayashi[_55_] Excel Programming 1 November 18th 04 02:47 PM


All times are GMT +1. The time now is 02:57 AM.

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"