Use of ListBox with VBA

  • Thread starter Thread starter Voskre
  • Start date Start date
V

Voskre

Hi,
I've an Excel listbox populated with numbers as text i.e.
'001
'002
etc

when selected the item, it returns into a cell in the following format:
1
2
etc.

I need to keep the leading zeros: how can I do it with VBA?

Thanks for any suggestion.

V
 
You could format the cell beforehand

With Range("B1")
.NumberFormat = "@"
.Value = ListBox1.Value
End With


--

HTH

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

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

Back
Top