Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
extra space
I'm running a macro to compare to sets of values, but it's not working because after one imported strings has a space on the end it
Grateful for any ideas to get round this problem. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
extra space
MAx
Check out the RTrim-function. -- Best Regards Leo Heuser Followup to newsgroup only please. "MAx" skrev i en meddelelse ... I'm running a macro to compare to sets of values, but it's not working because after one imported strings has a space on the end it. Grateful for any ideas to get round this problem. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
extra space
Max,
it kind of depends on where you're getting the data from and what you're diong with it. However, you can use the TRIM function to remove any leading or trailing spaces, either as a worksheet formula, which you can then use as a basis for your comparison: =Trim(B1) Or in your macro to manipulate the cell value: for X=1 to 10 If Application.WorksheetFunction.Trim(Cells(2,x).valu e)= _ Cells(1,x).Value Then ... your code here... End If Next X Cheers, Pete. -----Original Message----- I'm running a macro to compare to sets of values, but it's not working because after one imported strings has a space on the end it. Grateful for any ideas to get round this problem. . |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
extra space
Hi Max,
You can use the Trim function to remove leading and trailing blanks (before and after - not in the middle) Regards, Jean-Yves "MAx" wrote in message ... I'm running a macro to compare to sets of values, but it's not working because after one imported strings has a space on the end it. Grateful for any ideas to get round this problem. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
extra space
Hi <insert real name here aka MAx,
Did you really check the code or does it just look like a space. If you got the data from HTML you almost definitely have a code(160) nonbreaking space character. See TRIMALL macro for details http://www.mvps.org/dmcritchie/excel/join#trimall --- HTH, David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001] My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm Search Page: http://www.mvps.org/dmcritchie/excel/search.htm "MAx" wrote m... I'm running a macro to compare to sets of values, but it's not working because after one imported strings has a space on the end it. Grateful for any ideas to get round this problem. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
delete extra space | Excel Worksheet Functions | |||
Extra Line Space | Excel Discussion (Misc queries) | |||
Extra Line Space | Excel Discussion (Misc queries) | |||
Extra Line Space | Excel Discussion (Misc queries) | |||
Extra line space | Excel Discussion (Misc queries) |