Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VBA Excel 2000 - Replace

Posted on 2011-03-23
7
Medium Priority
?
249 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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 2000 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

597 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