Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 103
Default Extra space with vbNewLine

Below is a section of my code that works for the purpose i would like except
for one thing. I get an extra space at the end of each myCell.Value. It
seems to be everytime i use a vbNewLine it adds an extra space and then goes
to the next line. Is there a different funtion i could use?


myMsg = vbNewLine & vbNewLine & "Labor Rate: " & Range("baselaborrate") &
vbNewLine & vbNewLine
For Each myCell In myRng.Cells
If myCell.EntireRow.Hidden = True Then
'do nothing
Else
myMsg = myMsg & myCell.Offset(0, -2).Value & " Millwork: " & myCell.
Value & vbNewLine
End If
Next myCell
myMsg = myMsg & vbNewLine

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200706/1

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Extra space with vbNewLine

you can use (all work about the same in a msgbox)

chr(10)
chr(13)
vbCr
vbLf
vbCrLf
vbNewline

Sure the space isn't included in the text of the cell.

--
Regards,
Tom Ogilvy


"brownti via OfficeKB.com" wrote:

Below is a section of my code that works for the purpose i would like except
for one thing. I get an extra space at the end of each myCell.Value. It
seems to be everytime i use a vbNewLine it adds an extra space and then goes
to the next line. Is there a different funtion i could use?


myMsg = vbNewLine & vbNewLine & "Labor Rate: " & Range("baselaborrate") &
vbNewLine & vbNewLine
For Each myCell In myRng.Cells
If myCell.EntireRow.Hidden = True Then
'do nothing
Else
myMsg = myMsg & myCell.Offset(0, -2).Value & " Millwork: " & myCell.
Value & vbNewLine
End If
Next myCell
myMsg = myMsg & vbNewLine

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200706/1


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 103
Default Extra space with vbNewLine

I guess maybe i should have mentioned that myMsg goes to the .body of an
email. Still get the spaces with the below suggestions...any other thoughts?
The space isnt in the cell...

Tom Ogilvy wrote:
you can use (all work about the same in a msgbox)

chr(10)
chr(13)
vbCr
vbLf
vbCrLf
vbNewline

Sure the space isn't included in the text of the cell.

Below is a section of my code that works for the purpose i would like except
for one thing. I get an extra space at the end of each myCell.Value. It

[quoted text clipped - 12 lines]
Next myCell
myMsg = myMsg & vbNewLine


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200706/1

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default Extra space with vbNewLine

I guess maybe i should have mentioned that myMsg goes to the .body of an
email. Still get the spaces with the below suggestions...any other
thoughts?
The space isnt in the cell...


I think the spaces might be coming from the email program (I notice them
when I copy/paste from email messages). What if you apply the RTrim function
to the email lines that you end up concatenating vbNewLine onto. I think
like this may do for you....

myMsg = myMsg & myCell.Offset(0, -2).Value & _
" Millwork: " & RTrim(myCell.Value) & vbNewLine

and maybe here too...

myMsg = RTrim(myMsg) & vbNewLine

Rick

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
delete extra space WBTKbeezy Excel Worksheet Functions 8 October 8th 06 01:49 AM
Extra Line Space Leesa Excel Discussion (Misc queries) 1 May 24th 05 09:19 PM
Extra Line Space Leesa Excel Discussion (Misc queries) 0 May 24th 05 08:49 PM
Extra line space JJ Excel Discussion (Misc queries) 1 February 18th 05 11:32 PM
extra space MAx Excel Programming 4 May 11th 04 04:37 PM


All times are GMT +1. The time now is 03:57 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"