Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > VBA / Office Integration > Excel > SAP Number format not changing


Reply
 
Thread Tools Display Modes
  #1  
Old 09-02-2009, 07:36 AM
alejandrofh2 alejandrofh2 is offline
Newcomer
 
Join Date: Sep 2009
Posts: 2
Unhappy SAP Number format not changing


Hi,

I am downloading certain information from SAP and try to do some calculations with it, but somehow I am not able to change the number format with the macro i recorded. My decimal separator in excel is , and thousands separator is blank

Below examples on how numbers come from SAP:
-1.443,65
-733,89
-618,97
-1.668,06
-8.141,00

And I recorded a macro to convert them, ie: remove the dot and leave blank

.Columns("G:I").Select
Selection.Replace What:=".", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False

but when executing the macro, the results are wrong

-1443,65
-73389
-61897
-1668,06
-8141,00

It changed from 733,89 to 73389 and so on. I dont understand why the , was changed if the macro was supposed to change the dots

Could you please help me to fix this issue? Thanks in advance for your help

Br, Alejandro
Reply With Quote
  #2  
Old 09-02-2009, 07:01 PM
Josh Hazel Josh Hazel is offline
Senior Contributor
 
Join Date: May 2008
Posts: 805
Default

I tried it on my PC and it did not change the , to blanks... You might have your PC setup with "," being listed as a decimal, so when you find/replace for decimal perhaps the pc also replaces the commas.

See if this helps:

By default, Microsoft Excel uses the system separators that are defined in the regional settings in Control Panel. If you sometimes need to display numbers with different separators for thousands or decimals, you can temporarily replace the system separators with custom separators.

On the Tools menu, click Options.
On the International tab, under Number Handling, clear the Use system separators check box.
Type new separators in the Decimal separator and Thousands separator boxes.
Tip When you want to use the system separators again, select the the Use system separators check box.
__________________
Josh

If Google = NoHelp Then PostHere = True

Last edited by Josh Hazel; 09-02-2009 at 07:14 PM.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->