View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default need some code help please

Sorry about that, in my testing I just cut code to test for the number of
slashes, then added the rest in the posting.

Glad you sorted it.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
thanks bob, had to make a couple changes, but it seems to work fine.

i was using this, Len(.Value) - Len(Replace(.Value, "/", "")) = 1 , but

you
can see i was not using the mod function.

anyway, what i changed was:

1. you had a typo, a backslash instead of a slash in the formula.

2. the vbnewline didn't have the & in front of it and gave me the little
square box in the cell, so i changed it to chr(10)

thanks again.


--


Gary


"Bob Phillips" wrote in message
...
If .Value = "" Then
.Value = Left(Fname, Len(Fname) - 4)
Else
c = Len(.Value) - Len(Replace(.Value, "\", ""))
If c Mod 2 = 1 Then
.Value = .Value & "/" vbNewline
Else
.Value = .Value & "/"
End If
.Value = .Value & Left(Fname, Len(Fname) - 4)
End If
--


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
in the following code, i get the name from another sheet. if it's

blank,
it
just gives me the name, but if there is another name that goes in the
same
cell, i put a / between them

how would i put a chr(10) after every 2nd name, so only 2 fit on a line
in
each cell.


If .Value = "" Then
.Value = Left(Fname, Len(Fname) - 4)
Else
.Value = .Value & "/" & Left(Fname, Len(Fname) - 4)
End If
--


Gary