Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default ampersand operator unexpectedly trims?

In the immediate window, I input:

? "_" & " abc " & "_"

and it returns:

_ abc _


Why did it knock off all but one of the spaces off the right side of the
middle string?

Thanks,
Woody
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default ampersand operator unexpectedly trims?

It looks like it has something to do with the underscores. For instance:

?"_ _"
_ _

?"' '"
' '

?"_ '"
_ '

?"" Space(10) "<"
<


? "_" Space(10) "_"
_ _

? "_"; Space(10); "_"
_ _

? "_" Tab(10) "_"
_ _

? "" Tab(10) "<"
<



using Win 2K, Excel 2002

"Woody" wrote in message
.121...
In the immediate window, I input:

? "_" & " abc " & "_"

and it returns:

_ abc _


Why did it knock off all but one of the spaces off the right side of the
middle string?

Thanks,
Woody



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default ampersand operator unexpectedly trims?

Woody

you only have one space before abc and one after abc which is what the
return result shows

"_" & " abc " & "_"

gives a string of

_ abc _


---
Message posted from http://www.ExcelForum.com/

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default ampersand operator unexpectedly trims?

how do you explain this?

? "_"; Space(10); "_"
_ _

or this?

?"_ _"
_ _

"mudraker " wrote in message
...
Woody

you only have one space before abc and one after abc which is what the
return result shows

"_" & " abc " & "_"

gives a string of

_ abc _


---
Message posted from http://www.ExcelForum.com/



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default ampersand operator unexpectedly trims?

mudraker wrote in
:

Woody

you only have one space before abc and one after abc which is what the
return result shows

"_" & " abc " & "_"

gives a string of

_ abc _


---
Message posted from http://www.ExcelForum.com/


no, there are 3 spaces before and after "abc". This should make it more
obvious:

?"_" & space(3) & "abc" & space(3) & "_"
_ abc _



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default ampersand operator unexpectedly trims?

I don't know the correct answer but I beleive it has to do with VB
using _ as the symbol theat the line of code is continued on to th
next line and VBA automatically removing all extra spaces betwee
operators

--
Message posted from http://www.ExcelForum.com

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 459
Default ampersand operator unexpectedly trims?

This one's worthy of inclusion in j-walk's 'Excel Oddities':

http://j-walk.com/ss/excel/odd/index.htm

--
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cell Format changes unexpectedly HappyDaddy Excel Discussion (Misc queries) 1 October 7th 09 04:28 PM
Excel Closes Unexpectedly Lisa E. Excel Discussion (Misc queries) 3 December 12th 07 04:33 PM
Excel quits unexpectedly Simon Brown Excel Worksheet Functions 1 May 4th 07 11:36 PM
data changes unexpectedly Helen N. New Users to Excel 8 December 16th 04 03:49 PM
What does an ampersand mean in VBA? J S Excel Programming 2 November 20th 03 07:58 PM


All times are GMT +1. The time now is 08:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"