Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Noemi
 
Posts: n/a
Default Change Number to a negative in VBA

Hi
I currently have a range of numbers which need to be change from a positive
into a negative however I am not aware of the cell reference as the rows can
be more or less.

Does anyone know how to change a range of numbers from a positive into a
negative using VBA.

I actually need the number to be negative not just the format.

Thanks
Noemi
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben
 
Posts: n/a
Default Change Number to a negative in VBA

Noemi

If numbers are in Activecell column..........

Sub test()
Dim rcel As Range
Dim Rng As Range
Set Rng = Range(ActiveCell, Cells(Rows.Count, _
ActiveCell.Column).End(xlUp))
For Each rcel In Rng
If rcel.Value < "" And rcel.Value = 0 Then
rcel.Value = rcel.Value * -1
End If
Next rcel
End Sub


Gord Dibben Excel MVP

On Mon, 21 Nov 2005 21:16:02 -0800, "Noemi"
wrote:

Hi
I currently have a range of numbers which need to be change from a positive
into a negative however I am not aware of the cell reference as the rows can
be more or less.

Does anyone know how to change a range of numbers from a positive into a
negative using VBA.

I actually need the number to be negative not just the format.

Thanks
Noemi


  #3   Report Post  
Posted to microsoft.public.excel.misc
Jerry W. Lewis
 
Posts: n/a
Default Change Number to a negative in VBA

VBA is not required for this. Put -1 in an empty cell. Copy that cell.
Select the range of numbers whose sign you want to change. Edit|Paste
Special|Multiply.

Jerry

Noemi wrote:

Hi
I currently have a range of numbers which need to be change from a positive
into a negative however I am not aware of the cell reference as the rows can
be more or less.

Does anyone know how to change a range of numbers from a positive into a
negative using VBA.

I actually need the number to be negative not just the format.

Thanks
Noemi


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
adding a number to every change in value Breinn Excel Discussion (Misc queries) 3 October 12th 05 06:09 PM
how can I make a form number change everytime the form is opened babydumplingspita Excel Worksheet Functions 1 October 10th 05 07:58 PM
Change number in Text Box in Excel Jerry Dyben Excel Discussion (Misc queries) 2 September 23rd 05 02:40 AM
How to make the cell or font color red if the number is negative? Bob T Excel Worksheet Functions 6 August 18th 05 01:28 PM
How do I change the category axis number formatting in a Pivot Ch. Cultcab Charts and Charting in Excel 0 April 19th 05 12:26 AM


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