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

Hi.

I have a problem. When I import a .txt file create by an accountin
software, where there are negative numbers value in this format (fo
example 150-), after the importation those numbers have a text forma
and I can't sum them with the other numbers. I have a custom forma
(#.##0;#.##0-) but I can't apply it after the importation.

Can you help me

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Cells format

Hi
try using 'Data - Text to columns' to convert the negative
numbers to rela values

-----Original Message-----
Hi.

I have a problem. When I import a .txt file create by an

accounting
software, where there are negative numbers value in this

format (for
example 150-), after the importation those numbers have a

text format
and I can't sum them with the other numbers. I have a

custom format
(#.##0;#.##0-) but I can't apply it after the importation.

Can you help me?


---
Message posted from http://www.ExcelForum.com/

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Cells format

In most cases, a format does not affect what is stored in the cell. Excel
sees 150- as a string. Therefore, you number format has no effect. You can
use a macro to fix them

Select the cells and run a macro like this

Sub PostfixNegative()
Dim rng as Range, cell as Range
if selection.count 1 then
On Error Resume Next
set rng = selection.specialCells(xlConstants,xlTextValues)
On Error goto 0
else
set rng = selection
End if
if not rng is nothing then
for each cell in rng
if Right(trim(cell.value),1) = "-" then
Cell.Value = cdbl(cell.Value)
end if
Next
End if
End Sub

--
Regards,
Tom Ogilvy

"fragher75 " wrote in message
...
Hi.

I have a problem. When I import a .txt file create by an accounting
software, where there are negative numbers value in this format (for
example 150-), after the importation those numbers have a text format
and I can't sum them with the other numbers. I have a custom format
(#.##0;#.##0-) but I can't apply it after the importation.

Can you help me?


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Cells format

Doesn't work in Excel 2000 or Excel 97 at least. (as far as reevaluating
the cells. If you meant to separate the number from the negative sign, that
would be different).

--
Regards,
Tom Ogilvy

"Frank Kabel" wrote in message
...
Hi
try using 'Data - Text to columns' to convert the negative
numbers to rela values

-----Original Message-----
Hi.

I have a problem. When I import a .txt file create by an

accounting
software, where there are negative numbers value in this

format (for
example 150-), after the importation those numbers have a

text format
and I can't sum them with the other numbers. I have a

custom format
(#.##0;#.##0-) but I can't apply it after the importation.

Can you help me?


---
Message posted from http://www.ExcelForum.com/

.



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
Excel 2007 format cells to date format Stefan Excel Discussion (Misc queries) 0 June 1st 10 09:06 PM
How to format cells in Excel 2007 (i.e. currency format)? DonR Excel Discussion (Misc queries) 2 May 25th 08 11:16 PM
want format cells alignment not format cells font style Jeannie Bean Excel Discussion (Misc queries) 2 February 10th 06 09:31 AM
Cells won't convert to number format, even after format/cells/num. scottr Excel Discussion (Misc queries) 5 April 12th 05 11:02 PM
When I select "format cells", the format dialog box does not disp. Andy S. Excel Worksheet Functions 2 November 23rd 04 03:49 AM


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