Selasa, 30 Mei 2017

RE: [ExcelVBA] troublesom leading spaces

 

If they look like degree symbols when Show/Hide is on in Word, I suspect the spaces are "non-breaking spaces,"   in HTML and Chr(160) in VB/A. Try using LTrim() to remove them from the string.

  

Hafizullah
@}->-`-,---

 


From: ExcelVBA@yahoogroups.com [mailto:ExcelVBA@yahoogroups.com]
Sent: Tuesday, May 30, 2017 7:10 pm
To: ExcelVBA@yahoogroups.com
Subject: [ExcelVBA] Digest Number 3319

 

7 Messages

Digest #3319

1c

Re: Find Replace of spaces by "David Smart" smartware_consulting

1d

Re: Find Replace of spaces by "David Smart" smartware_consulting

1e

Re: Find Replace of spaces by "Derek" g4swy

1f

Re: Find Replace of spaces by "Paul Vermeulen" zs_psk

1g

Re: Find Replace of spaces by "Thomas Hutchins" hutch99999

Messages

Mon May 29, 2017 10:29 pm (PDT) . Posted by:

zs_psk

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

Mon May 29, 2017 11:06 pm (PDT) . Posted by:

zs_psk

I also tried pasting the text into Word, with and without formatting, to see any special characters. With formatting it looks like a degree symbol (Alt-248), and without formatting it looks like a space. Neither work as a direct copy and paste into the Excel SUBSTITUTE formula.

Another thought that has occurred to me is that the table may be formatted to prevent copying, in which case they are going to extraordinary lengths.

Mon May 29, 2017 11:21 pm (PDT) . Posted by:

"David Smart" smartware_consulting

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 -----
From: paul.vermeulen@vulcantech.com.au [ExcelVBA]
To: ExcelVBA@yahoogroups.com
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

Mon May 29, 2017 11:25 pm (PDT) . Posted by:

"David Smart" smartware_consulting

OK, that's the Word non-breaking space. Just tried putting one into a cell, then doing a find/replace on it. It seems to work.

Either put the character into the find/replace with ALT:248, or use copy/paste out of an F2 of the cell.

Regards, Dave S

----- Original Message -----
From: paul.vermeulen@vulcantech.com.au [ExcelVBA]
To: ExcelVBA@yahoogroups.com
Sent: Tuesday, May 30, 2017 4:06 PM
Subject: [ExcelVBA] Re: Find Replace of spaces

I also tried pasting the text into Word, with and without formatting, to see any special characters. With formatting it looks like a degree symbol (Alt-248), and without formatting it looks like a space. Neither work as a direct copy and paste into the Excel SUBSTITUTE formula.

Another thought that has occurred to me is that the table may be formatted to prevent copying, in which case they are going to extraordinary lengths.

Mon May 29, 2017 11:26 pm (PDT) . Posted by:

"Derek" g4swy

This looks like the html hard space ascii 160.

Sent from Samsung Mobile on O2

-------- Original message --------
From: "paul.vermeulen@vulcantech.com.au [ExcelVBA]" <ExcelVBA@yahoogroups.com>
Date:30/05/2017 07:06 (GMT+00:00)
To: ExcelVBA@yahoogroups.com
Subject: [ExcelVBA] Re: Find Replace of spaces

I also tried pasting the text into Word, with and without formatting, to see any special characters. With formatting it looks like a degree symbol (Alt-248), and without formatting it looks like a space. Neither work as a direct copy and paste into the Excel SUBSTITUTE formula.

Another thought that has occurred to me is that the table may be formatted to prevent copying, in which case they are going to extraordinary lengths.

Mon May 29, 2017 11:43 pm (PDT) . Posted by:

"Paul Vermeulen" zs_psk

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 -----
From: paul.vermeulen@vulcantech.com.au [ExcelVBA]<mailto:paul.vermeulen@vulcantech.com.au%20[ExcelVBA]>
To: ExcelVBA@yahoogroups.com<mailto:ExcelVBA@yahoogroups.com>
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

Tue May 30, 2017 3:40 am (PDT) . Posted by:

"Thomas Hutchins" hutch99999

Hi Paul, 
Does =Value (Trim (C1)) return a usable number?
Hutch

Sent from Yahoo Mail on Android

__._,_.___

Posted by: "Hafizullah" <hafizullah@aol.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.

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