equalise text length in combo box

S

sunilpatel

I thought this was going to be easy !
i have a 2 column combo, in the 2nd column i join two strings e.g name and
six digit customer number.
As the names vary in length (number of characters), the customer numbers do
not line up vertically.
Hence i add spaces to the name to make all the names the same length. But i
soon realised that this does not work
as one character is not equal to one space.

is there a fix for this. I cannot use 3 coulmn combo and cannot put customer
number in column 1 and name in column two.

If n$<25 then
NumSpaces%= (25 - Len(N$))
N$ = N$ & String(NumSpaces%, " ")

Is there a formula or another solution to this?

Thank

Sunil
 
R

Rick Rothstein

Don't use spaces... use Tab characters instead. VB has a constant defined
for the named vbTab... just concatenate one or more (depending on how
different the length of your names can be) of them between your names and
your numbers. As an example, something like this...

MyArray(1, 1) = Name1 & vbTab & vbTab & Number1
 
P

Patrick Molloy

what you are doing will work fine if you use a text font such as "Courier
New"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top