Formatting negative numbers #2

I have a text file that gets imported into Excel on a 
regular basis.  The negative numbers come into the 
spreadsheet in this format:  4000.00-  and I want to know 
if I can write a macro to change all those instances 
to:  -4000.00, moving the negative sign to the proper 
place.  Anyone know if that can be done.  In the past we 
used an old dos application to do that prior to importing 
it into Excel, but I want to get away from that if we 
could and just let Excel do it.  There are other places 
in the file that contain text with dashes in it, so I 
want it only to find the numbers with negative symbols, 
or dashes in them!!!  Thanks in advance.
0
tim.buffo (1)
5/10/2004 1:23:02 PM
excel.misc 78881 articles. 5 followers. Follow

1 Replies
438 Views

Similar Articles

[PageSpeed] 51

Here is something I picked up from 
http://www.mcgimpsey.com/excel/postfixnegatives.html 
previously posted in this newsgroup.

Public Sub ConvertTrailingMinuses()
        Dim cell As Range

        On Error Resume Next
        For Each cell In ActiveSheet.Cells.SpecialCells( _
                xlCellTypeConstants, xlTextValues)
            With cell
                If IsNumeric(.Value) Then _
                .Value = CDbl(.Value)
            End With
        Next cell
        On Error GoTo 0
    End Sub

Charlie O'Neill
>-----Original Message-----
>I have a text file that gets imported into Excel on a 
>regular basis.  The negative numbers come into the 
>spreadsheet in this format:  4000.00-  and I want to know 
>if I can write a macro to change all those instances 
>to:  -4000.00, moving the negative sign to the proper 
>place.  Anyone know if that can be done.  In the past we 
>used an old dos application to do that prior to importing 
>it into Excel, but I want to get away from that if we 
>could and just let Excel do it.  There are other places 
>in the file that contain text with dashes in it, so I 
>want it only to find the numbers with negative symbols, 
>or dashes in them!!!  Thanks in advance.
>.
>
0
anonymous (74718)
5/10/2004 2:02:02 PM
Reply:

Similar Artilces:

negative number format
I have a report uploaded to excel from a particular program used here at work. In that program, negative numbers have the format of $###.00-, with the minus sign at the end instead of the beginning. When the data comes over to Excel the minus sign is still at the end of the number. The text currently has a General Format with No Specific Number Format. I have been manually moving the minus signs to the beginning in each cell, then changing the Column to Currency Number Format which is very time consuming. Is there a formula I can use in the Cell, Column and/or Worksheet containing...

cannot empty Clipboard #2
Quite often, but not all the time, when I want to drag a cell to a different position, I get the message " cannot empty Clipboard" . Then I have to click on "OK" and everything is fine. This is very annoying and wasting a lot of time. What to do about it ?? Thanks for any help. Wolf [Zscheile] ...

Change date format to European format
My computer is set to European date format but Excel is default to American date format. Can someone advise how to change this default setting. Thanks, Scott Have you restarted Excel since setting the system date formatting? Excel takes its cue from the OS on launch. Also, double-check the Regional setting in the System Prefs. If those aren't the cause you'll need to be specific about your version & update levels of both Office & OS X plus any other details you can supply. -- HTH |:>) Bob Jones [MVP] Office:Mac "Scott" <NoSpam-Scot...

Formatting just some rows
Thank you so much for that, it'll save loadsa time. I adjusted the formula as the original sheet contined 11 columns of data. Can you help with this part now? The original sheet had dates in Column E (in the form Jan-03). Thay have come through on the new sheet in the single column as 5 digit figures such as 37622. Is there any way of getting the original form of the date back, affecting just rows 5, 16, 27 etc...of the new sheet? Perhaps I need to format just these rows on the NEW sheet. A similar problem exists with column I of the original where the � sign has been lost. Again is t...

HOw do i start outlook? #2
My outlook doesn't go past the check name screen? what do I do? Presumably it worked before? And the version is? You could try a repair using your Office or Outlook cd "mhabit" <mhabit@discussions.microsoft.com> wrote in message news:4E1B2630-9B20-444F-BF65-6B7E41638450@microsoft.com... > My outlook doesn't go past the check name screen? what do I do? The Check Name function is part of a Microsoft Exchange account. Are you trying to connect to a Microsoft Exchange server? Or your ISP? Joe "mhabit" <mhabit@discussions.microsoft.com> wrote i...

freezing formatting
I would like to be able to "freeze" the formatting for the number of decimal places in cells - some will need to be integers, some will need three decimal places, etc. The problem comes when I paste in information; the number of decimal places I have formatted the cell for is overridden by the pasted-in data. Any ideas? On Fri, 24 Oct 2003 13:31:05 -0700, "H" <anonymous@discussions.microsoft.com> wrote: >I would like to be able to "freeze" the formatting for the number of decimal places in cells - some will need to be integers, some will need three de...

Question about format of reply and format of message
I have two questions about OL2003: 1. Word is set as default editor. In replying message, sometimes I will get extra lines on hitting Enter. It makes more space between paragraphs. Is there any way to insert one line with one Enter? 2. I'd like to have special effect in replying text message sometimes, such as change color of font, but it cannot be done unless changing the message format to be rich text or HTML. If I uncheck Word as default editor, there is an option in menu. What is it about with Word as editor? Thanks, Charles 1 - Check the paragraph spacing settings e...

TOC Heading style 2
I am working in 2007 from someone else's doc from 2003 word. I will be saving in 97-2003. The styles shown in the home tab start Emphasis - Heading 1 - Normal - Strong (and others). I am trying to insert a TOC using the built in heading styles but I cannot see a Heading 2 or 3. How can I add the other headings to this group - is this a special style group added by the other author? TIA Dottie I opened this doc in 2003 word and was able to add the heading 2 there so I may have my answer for now. I would still like to know what I needed to do in 2007 word to make heading...

Negative number formatting
Hi everyone, does anyone know how to do this? I hve a column of figures some positive and some negative. I want to format them so taht th negative numbers are expressed in (brackets) and also so that th column itself is decimal aligned, so even if I don't use decimal place the brackets "stick out". I know Word does this in tables, but I can' seem to make Excel do it. Help! Thanks, Vicky. :confused -- VickyJone ----------------------------------------------------------------------- VickyJones's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=2448 ...

Enforce format
How can I "enforce" a format in a cell in excel so that it allows number entry only, i.e. it does not allow letters or any other characters. Thanks in advance. Keith Data Validation; custom formula; If active cell is A1, use this: =NOT(ISERROR(1*A1)) "Elfey1001" <Elfey1001@discussions.microsoft.com> wrote in message news:D744EEFC-3BD0-43A7-B673-F16107BBFA03@microsoft.com... > How can I "enforce" a format in a cell in excel so that it allows number > entry only, i.e. it does not allow letters or any other characters. > Thanks in advance. > Kei...

Format Smartlist field
Is it possible to format a smartlist field? Let's say from 2 decimals to 4 decimals? -- SmokyDuck This is only possible in SmartList Builder SmartLists, not in the 'out of the box' SmartLists. In SmartList Builder, you can click on the Display Name of a field, then click the blue arrow in the header to go to Set Field Options. For number fields there will be a tab called Decimal Places. -- Victoria Yudin Dynamics GP MVP Flexible Solutions, Inc. "Smokyduck" <Smokyduck@discussions.microsoft.com> wrote in message news:98223149-4092-484D-886D-F03A319319E...

Conditional Formating Help
Hi I wonder if anyone could help me, I am after code for the following. cell e6 = Keys Sent Column f6 = Keys due Column g6 = Keys received What I want the script to do is if there is no value in g6 and todays date is greater then the date stated in F6, then the cell turns red (prompt to inform me that keys are late). Many thanks Dan Use a CF formula of =AND(G6="",TODAY()>F6) HTH Bob "housinglad" <housinglad@discussions.microsoft.com> wrote in message news:A5887369-33DA-489A-BEC9-8173707313C6@microsoft.com... > Hi > ...

Outlook 2003 unresponsive when viewing messages in HTML format.
About two weeks ago, I started Outlook and went in to view messages. On some messages, Outlook would appear to lock up and my harddrive light would come on continuously for a minute or more. The body of the message would appear as an empty window. We have discovered that the problem only occurs for email messages that are in HTML format. I can prevent the problem by going to: Tools > Options > Email Options and checking "Read all standard mail in plain text". When I have this option turned on, I can see a plain text version of the message. Unfortunately, much of ...

Select Case Conditional Formatting Sub?
I've tried to use the Sub below (Posted by Julie D I think) as a work around for more than three conditional formats and it works great IF I enter the data directly in the target cells. But, if the taget range is populated by a formula the color changes do not occur. Is there a way to modify this to work when the cells in the target range are formula driven? (Or, maybe I'm doing something wrong, any ideas?) Private Sub Worksheet_Change(ByVal Target As Range) On Error GoTo ws_exit: Application.EnableEvents = False If Not Intersect(Target, Range("B6:B10")) Is Nothing...

Add opt. to change Printer-Friendly format to user defined format
This is a customer suggestion from Convergence. Customer would like to be able to have the option to change the Printer-Friendly format to a different/user defined format. 1. Employee enters a requisition. 2. Purchasing manager processes the Requisition: BP>Purchasing>Requisitions 3. Select a vendor and requisition. 3. User selects to view the requisition; Printer-Friendly Version opens. ISSUE: Currently, there are no options to define report format. For further inquiry- Customer Information: Jon Heseman, PC Administrator EFCO Systems 1800 N.E. Broadway Des Moines, Iowa...

How do I mail merge for postcards in MS Publisher 2 or 4 per page.
Can anyone help? Create a mail merge Step by step instructions http://office.microsoft.com/en-us/assistance/HP052584251033.aspx -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "reechemist" <reechemist@discussions.microsoft.com> wrote in message news:D6E75713-F19E-4AA3-81E8-98E0BFD795A5@microsoft.com... > Can anyone help? ...

Canadian Payroll Tax updates #2
Just a heads up...as I donot see it here...or on the KB I just spent 3 hours updating 6 machines..... Which actually only took an hour...then we had to convert our Canadian Payroll files...then...Canadian payroll just disappeared from the users install...although..when logging in as SA it would be available... Seeing I have been running the Canadain Payroll for 5 + years now...and am well used to the "bugs" with the yearend updates....I remember seeing this error after an application version upgrade from 7.0 to 7.5...where no one other then SA could run payroll.....and I spen...

Trouble Printing Checks #2
I'm using Money 2004. I have a list of checks to be printed, but no 'Print Checks' on the left side panel. When I go the 'File' menu to print checks it gives me a "You don't have any accounts with checks to be printed." message. What can I do? David See http://umpmfaq.info/faqdb.php?q=91. "David" wrote: > What can I do? I would run a file repair to see if that will correct the number do indicate the number of checks that have been set to "print". "David" <David@discussions.microsoft.com> wrote in message news...

Searching through DB Table containing Records in XML format
Guru's! Your time and guidance is much appreciated in this task that i am trying to get done. Background I have a SQL Server 2000 database table which contains 2 Fields (RecordID, XMLData (datatype=TEXT). There are about 10,000 records in this table. The Data in the field (XMLData) is a XML formatted string. (where F1,F2... are elements and v1, v2 is the data) <ControlRecord><F1>V1</F1><F2>V2</F2><F3>V3</F3><F4>V4</F4><F5>v5</F5><f6>v6 </f6>.....Upto 14 fields </ControlRecord> <ControlRecord><...

How to format the value in a cell?
Hello! I wonder if excel has the function to format a value in cell without the help of Macro. To format a value,here I mean to correct the value automatically. For example,it need the value in a cell to be "T".But a user may enter " T","T ","t".The formatting function used here to trim the space at the begining or end of "T",or change the "t" to upper case. -------------------- An Try =TRIM(UPPER(A1)) -- Regards Roger Govier "An" <abc@sohu.com> wrote in message news:u%23Kg%23X6hFHA.576@tk2msftngp13.phx.gb...

Tape Symbolic Name #2
I have three tape drives w/ symbolic names of tape0, tape1, and tape2. While running in a linux environment, there is no problem, but when running in WinXP, windows switches the symbolic names around, which ruins a tape read program I use. Any ideas on how to fix this? Thanks by the way, this is written in VC++ 2003 .Net Jeremiah Thoman ...

extracting data from one format to a different format...
I have a large database of company contacts that is formatted/entered as follows: ABC Company, Inc. John Doe 123 Main Street NE Des Moines, IA 52000 Phone: 123-456-7890 Fax: 098-765-4321 jdoe@abccompany.com Each line is in it's own cell, but I need it in column format such as follows: Company Name - First Name - Last Name - Address1 - Address2 - City - State - Zip - Phone - Fax - Email Any direction as to how I can easily do this? I'm using either 2003 or 2007 and have over 7,000 entries like this. PLEASE HELP as I don't want to spend hours into days try...

Remove formatting from SSN
I exported some data from an Access database. The Social Security Numbers are in this format: 123-45-6789. I would like to change them all to 123456789. I've tried creating a Custom Format and formatting the cells, but nothing changed. Tried setting the format of a new column, then cutting and pasting or Paste Special into the new cells, but it keeps the old formatting. Is there an answer? Try this in a "helper" column: =TEXT(A1,"000000000") To retain your leading zeroes. -- HTH, RD ============================================== Please keep all corres...

Copying Messages #2
I've just got a new PC and would like to copy all the messages from Outlook Express 6 on my old PC to the same program on my new one. What's the best way to achieve this? I have networked the two machines together so can copy any required files between the two. Thanks Jim Goddin Sorry, just realised I should have posted this in the Internet Expolorer area >-----Original Message----- >I've just got a new PC and would like to copy all the >messages from Outlook Express 6 on my old PC to the same >program on my new one. > >What's the best way to achie...

Formatting numbers
Pub2002/XP - how to format numbers in a table - I want it to automatically space for thousands etc and align the numbers correctly ie. 1 650 243 500 etc You will have to do it manually, or copy and paste it from a spreadsheet. -- See if Courier font will do it. Most other fonts do proportional spacing i.e. the letter m is wider than an l. In Courier (maybe teletype, typewriter and a few other fonts) use the same width of space and thus will line up columns from row to row. -- Don Vancouver, USA, a great city in one of the 45+ countries in America! "simonh" <si...