Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default NumFormat problems when exchanging dot to comma

I get a file from SAP where the numbers are strangly formatted. Decimal is
dot and in some cells there is also blank space before (xxx0.0 or x254.45)x
means space.
What I need to do is first to change dot to comma since it is standard in
Sweden, then format the cells with commaseparator and 2 decimals.
This is no problem when I do it manually.
When I use Record Macro, it also works when recording, but not when I test
the code.
The result is that all cells are formatted as text and the smarttag gives
information that the cell is either formatted as text or is proceeded with an
apostrof.
Manually I can convert to number but not through code.
I have also tryed to use the funktion TRIM to remove all blanks and to
replace blanks with "nothing". I have tryed Data, text to column without
success.
Everyting I do works manually but not after recording.
Please can anybody help me!?
Lena
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default NumFormat problems when exchanging dot to comma

1) Use the val() function
2) change formating of cell before writing a number to convert from a string
Range("A1").numberformat = "general"
3) use the formatt function
newnumber = format(val(mynumber),"General")


I think you arre having problems with local formating in Sweeden. I think
there are bugs with excel 2007.


"Lena_Office" wrote:

I get a file from SAP where the numbers are strangly formatted. Decimal is
dot and in some cells there is also blank space before (xxx0.0 or x254.45)x
means space.
What I need to do is first to change dot to comma since it is standard in
Sweden, then format the cells with commaseparator and 2 decimals.
This is no problem when I do it manually.
When I use Record Macro, it also works when recording, but not when I test
the code.
The result is that all cells are formatted as text and the smarttag gives
information that the cell is either formatted as text or is proceeded with an
apostrof.
Manually I can convert to number but not through code.
I have also tryed to use the funktion TRIM to remove all blanks and to
replace blanks with "nothing". I have tryed Data, text to column without
success.
Everyting I do works manually but not after recording.
Please can anybody help me!?
Lena

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default NumFormat problems when exchanging dot to comma

Hi!
I use Excel 2003 this time but I guess it can be a problem any way. I have
tried now and probably I am not "good enought".
How do I get the val() function to convert a range of cells like (F:L)? Can
you give me a complete code string?
Lena

"Joel" skrev:

1) Use the val() function
2) change formating of cell before writing a number to convert from a string
Range("A1").numberformat = "general"
3) use the formatt function
newnumber = format(val(mynumber),"General")


I think you arre having problems with local formating in Sweeden. I think
there are bugs with excel 2007.


"Lena_Office" wrote:

I get a file from SAP where the numbers are strangly formatted. Decimal is
dot and in some cells there is also blank space before (xxx0.0 or x254.45)x
means space.
What I need to do is first to change dot to comma since it is standard in
Sweden, then format the cells with commaseparator and 2 decimals.
This is no problem when I do it manually.
When I use Record Macro, it also works when recording, but not when I test
the code.
The result is that all cells are formatted as text and the smarttag gives
information that the cell is either formatted as text or is proceeded with an
apostrof.
Manually I can convert to number but not through code.
I have also tryed to use the funktion TRIM to remove all blanks and to
replace blanks with "nothing". I have tryed Data, text to column without
success.
Everyting I do works manually but not after recording.
Please can anybody help me!?
Lena

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default NumFormat problems when exchanging dot to comma

for each cell in Range("A1:G7")
if cell < "" then
cell = val(cell)
end if
next cell

Is F:L columns?

You could also do
for each cell in Columns("F:L")
if cell < "" then
cell = val(cell)
end if
next cell

"Lena_Office" wrote:

Hi!
I use Excel 2003 this time but I guess it can be a problem any way. I have
tried now and probably I am not "good enought".
How do I get the val() function to convert a range of cells like (F:L)? Can
you give me a complete code string?
Lena

"Joel" skrev:

1) Use the val() function
2) change formating of cell before writing a number to convert from a string
Range("A1").numberformat = "general"
3) use the formatt function
newnumber = format(val(mynumber),"General")


I think you arre having problems with local formating in Sweeden. I think
there are bugs with excel 2007.


"Lena_Office" wrote:

I get a file from SAP where the numbers are strangly formatted. Decimal is
dot and in some cells there is also blank space before (xxx0.0 or x254.45)x
means space.
What I need to do is first to change dot to comma since it is standard in
Sweden, then format the cells with commaseparator and 2 decimals.
This is no problem when I do it manually.
When I use Record Macro, it also works when recording, but not when I test
the code.
The result is that all cells are formatted as text and the smarttag gives
information that the cell is either formatted as text or is proceeded with an
apostrof.
Manually I can convert to number but not through code.
I have also tryed to use the funktion TRIM to remove all blanks and to
replace blanks with "nothing". I have tryed Data, text to column without
success.
Everyting I do works manually but not after recording.
Please can anybody help me!?
Lena

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
Save as comma csv problems rock[_2_] New Users to Excel 1 August 26th 09 01:44 PM
Finding Problems in Comma Separated List Daren Excel Worksheet Functions 5 January 9th 09 05:22 PM
Exchanging information BBS0 Excel Worksheet Functions 2 December 2nd 08 03:38 AM
exchanging X and Y in a plot Bruce Bowler Excel Programming 3 August 5th 05 02:33 PM
Problems converted comma seperated CVS file! Lars Grøtteland Excel Programming 1 April 29th 04 10:41 AM


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