ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Adding a space? (https://www.excelbanter.com/excel-programming/384021-adding-space.html)

Sjakkie

Adding a space?
 
I have an array which holds names and details i have been able to set "test1"
to the longest name in the array and add 5 more spaces. I then want it to
lookat the first value in the array and count howmany characters it is if it
is less than that that was stored in "test1" i want it to add spaces on
untill it reaches the same ammount as "test1" is this possible?

Bob Phillips

Adding a space?
 
ary(0) = Space(Len(test1) - Len(ary(0))) & ary(0)


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Sjakkie" wrote in message
...
I have an array which holds names and details i have been able to set
"test1"
to the longest name in the array and add 5 more spaces. I then want it to
lookat the first value in the array and count howmany characters it is if
it
is less than that that was stored in "test1" i want it to add spaces on
untill it reaches the same ammount as "test1" is this possible?




Tom Ogilvy

Adding a space?
 
s = arr(lbound(arr))
if len(s) < len(test1) then
s = s & string(len(test1)-len(s)," ")
arr(lbound(arr)) = s
end if

--
Regards,
Tom Ogilvy


"Sjakkie" wrote:

I have an array which holds names and details i have been able to set "test1"
to the longest name in the array and add 5 more spaces. I then want it to
lookat the first value in the array and count howmany characters it is if it
is less than that that was stored in "test1" i want it to add spaces on
untill it reaches the same ammount as "test1" is this possible?



All times are GMT +1. The time now is 09:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com