Enter contents from listbox as text

brianfosterblack

Active Member
Joined
Nov 1, 2011
Messages
251
I have a listbox in my userform set with bound columns as 3 and column count as 3
I have this code to enter the number in the last column into my workbook
However this is a 13 digit number so I want to enter it as text.
It is actually text in my workbook (the range that populates the listbox) but somehow on entering it, it converts it to a number
VBA Code:
Private Sub CommandEmail_Click()
    Range("Invoice!N3").Value = FrmInvoice.ListBox1.Value
    Unload FrmInvoice
End Sub
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Try Range("Invoice!N3").Value = "'" & FrmInvoice.ListBox1.Value

Bye
 
Upvote 0
Solution
Catullo said:
Odi et amo. Quare id faciam, fortasse requiris.
Nescio, sed fieri sentio et excrucior.
In this case the the why is easy to explain: I add a "single quotation mark" at the beginning of the texbox value, and this symbol is for excel the prefix for "text"

Bye
 
Upvote 0
@brianfosterblack
In future when marking as solution can you please mark the post that has helped, rather than your post saying it worked. I have changed it for you this time. Thanks
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,702
Members
448,980
Latest member
CarlosWin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top