View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
[email protected] garyusenet@myway.com is offline
external usenet poster
 
Posts: 33
Default Counting the length of a string and adding spaces...

Hi Bob,

That is giving the same error, i've checked and I think that code is
identical to the first code you posted.

Thanks again,

Gary.

Bob Phillips wrote:
See if this helps

With ActiveCell
sMake = Cells(.Row, make).Value
sModel = Cells(.Row, model).Value
sExpiry = Cells(.Row, expirary).Value
sCommission = Cells(.Row, commision).Value
textstring = sMake & Space(20 - Len(sMake)) & " - " & _
sModel & Space(30 - Len(sModel)) & " - " & _
sExpiry & Space(30 - Len(sExpiry)) & " - " & _
"£" & sCommission & Space(30 - Len(sCommission)) & _
Chr(10)
End With



--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
ups.com...
Thank you Bob that looks ideal, but there is a slight problem at the
moment - when I run the code i get an error that mentions an 'invalid
procedure call or argument'. When I click debug the following code is
highlighted: -

textstring = sMake & Space(20 - Len(sMake)) & " - " & _
sModel & Space(30 - Len(sModel)) & " - " & _
sExpiry & Space(30 - Len(sExpiry)) & " - " & _
"£" & sCommission & Space(30 - Len(sCommission)) &
Chr(10)


Thanks,

Gary