Solved

VBA Excel 2000 - Replace

Posted on 2011-03-23
7
236 Views
Last Modified: 2012-05-11
Dear Experts,

Could you please have look the attached file, basically its A column is a download from an outer system.

You can see for example in cells A4 or A20, that the download saved the quantities in such format
       1.774,000
       5.100,000

My target would be to replace the "." characters so getting
1774
5100

Basically I have a macro which I assume should do it, but this creates the cell values like 1774000 and 5100000 on the example

Sub SimpleReplaceInColumn()
[A:A].Replace ".", vbNullString
End Sub

Could you please advise how this code should be modified to bring the quantities according to the target? It is interesting because selecting menu Edit/Replace and Find what "." to replace with nothing, that works

thanks,
Download.xls
0
Comment
Question by:csehz
  • 4
  • 2
7 Comments
 
LVL 1

Author Comment

by:csehz
ID: 35197245
Maybe a small addition the in Regional settings if that has some effect, the Decimal symbol is ",", but on that I can not change as has fear that in other files Access import specifications would be confused.

Also attached now a picture about the problem

thanks,
Download.jpg
0
 
LVL 6

Expert Comment

by:KnutsonBM
ID: 35197263
does everything end with ,000?

-Brandon
0
 
LVL 1

Author Comment

by:csehz
ID: 35197283
Brandon no, the download save logic seems that if the quantity is less than 1000, those are as numbers without "."

But if the quantity is greater or equal than 1000, for those the pattern is 1.000,000. So using "." for thousands, "," for decimals.
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 1

Author Comment

by:csehz
ID: 35197291
I assume your question is whether for sure all quantity has always ,000 as decimal, in this example yes but can not guarantee that in all download such would be
0
 
LVL 7

Accepted Solution

by:
Jignesh Thar earned 500 total points
ID: 35197356
Csehz - Try below code. It saves your decimal point before doing away with "." and replaced decimal back.

It will interprete 1.774,123 as 1774.123 apart from what you described.


Sub SimpleReplaceInColumn()
[A:A].Replace ",", vbCrLf ' Save decimal position
[A:A].Replace ".", vbNullString
[A:A].Replace vbCrLf, "." ' Restore decimal position
End Sub

Open in new window

0
 
LVL 1

Author Closing Comment

by:csehz
ID: 35197427
That works perfectly :-) You are amazing thanks very much your help.

On my machine even the 1.774,123 example brought 1774,123 which is correct
0
 
LVL 7

Expert Comment

by:Jignesh Thar
ID: 35197437
csehz - Glad it worked.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

What is a Form List Box? (skip if you know this) The forms List Box is the alternative to the ActiveX list box. If you are using excel 2007, you first make sure you have a developer tab (click the Orb)->"Excel Options"->Popular->"Show Developer tab…
Dealing with unintended Excel Active-X resizing quirks (VBA code simulates "self correction") David Miller (dlmille) Intro Not everyone is a fan of Active-X controls in spreadsheets (as opposed to the UserForm approach, the older Form controls …
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now