Thanks David and Derek
The random thoughts worked. The only solution that worked was copying the character in Excel, and inserting into the SUBSTITUTE formula. I still don't know what it is, as character 160 and 248 do not work. EDIT – Character 0160 (non-breaking space) does work.
Extracted a line from the page source code which gives values as 115.300
Then copy, paste as values next column, and then Text to Columns to split data into columns. Very convoluted, but it works.
Both your help is much appreciated.
Paul
From: ExcelVBA@yahoogroups.com [mailto:ExcelVBA@yahoogroups.com]
Sent: Tuesday, 30 May 2017 4:21 PM
To: ExcelVBA@yahoogroups.com
Subject: Re: [ExcelVBA] Find Replace of spaces
Hi Paul
Random thoughts/guesses.
See what =Value(cell) does. It might look past the white space and extract the number.
The spaces you're seeing are presumably not normal spaces. Could be non-breaking spaces (e.g. from Word) or tabs. You might be able to find out which by doing an "inspect element" in the web browser.
There is a Code() function that returns the ASCII code of the first character from a cell (or the string returned by a Mid() function). This will let you see what it is (although it won't help you eliminate it).
You might be able to F2 a cell and then grab the blank character with Ctrl-C and then Ctrl-V it into the find part of a find/replace. Backup carefully first, of course, in case it replaces too much. :-)
If none of these work, you might like to upload the file or send it to me and I'll have a look at it.
Regards, Dave S
----- Original Message -----
Sent: Tuesday, May 30, 2017 3:29 PM
Subject: [ExcelVBA] Find Replace of spaces
Hi all
I am struggling with a table imported into Excel from a web page.
It correctly formats as a table in terms of columns, but the numbers all have the format of [SPACE]122.500[SPACE], General formatting.
Find and replace of [SPACE] with nothing gives an error message.
Interestingly, =SUBSTITUTE(C1," ","") does not give an error message, but does not remove the spaces. If I test it by multiplying the result with 1, I get a #VALUE error, and the spaces are visually still there.
I can't test for TAB, as it has special functions in Excel. Try using it in a formula!
Any ideas?
Regards
Paul
Posted by: Paul Vermeulen <paul.vermeulen@vulcantech.com.au>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (6) |
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.
----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA
----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com
----------------------------------
Tidak ada komentar:
Posting Komentar