Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: 18 Nov 2005 12:36:58 -0800,    group: microsoft.public.word.vba.customization        back       


Deleting last letter if a cell   
What I'd like to do is, if the last letter of what is inputed into a
cell is the "+" symbol. Then delete it.

I have a cell defined by:
Sheet12.Cells(11, 2) = d & "+" + l & "+" + w & "+" + s

Here's what i get fromt that cell.
..5D + 2L + 3W + 2S

if i change it and s = 0 i get
..5D + 2L + 3W +

i want to get
..5D + 2L + 3W

So i was hoping maybe there was a command, to delete a space off the
end of a cell using and IF statement.

IF last letter is a "+" , delete 1-2 spaces of the end of the cell.
date: 18 Nov 2005 12:36:58 -0800   author:   unknown

Re: Deleting last letter if a cell   
This is a  Word newsgroup, but ..

(a) I would use "&" consistently for concatenation, and ..
(b) Change  ....w & "+" + s at the end to ...
      w & IIf(Val(s) = 0, "", "+" & s)

--
Enjoy,
Tony


 wrote in message
news:1132346218.214122.193920@f14g2000cwb.googlegroups.com...
> What I'd like to do is, if the last letter of what is inputed into a
> cell is the "+" symbol. Then delete it.
>
> I have a cell defined by:
> Sheet12.Cells(11, 2) = d & "+" + l & "+" + w & "+" + s
>
> Here's what i get fromt that cell.
> .5D + 2L + 3W + 2S
>
> if i change it and s = 0 i get
> .5D + 2L + 3W +
>
> i want to get
> .5D + 2L + 3W
>
> So i was hoping maybe there was a command, to delete a space off the
> end of a cell using and IF statement.
>
> IF last letter is a "+" , delete 1-2 spaces of the end of the cell.
>
date: Sat, 19 Nov 2005 22:38:09 -0000   author:   Tony Jollans My Forename at My Surname dot com

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us