Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get only a certain digit in a number? 2

Status
Not open for further replies.

Sidro

MIS
Sep 28, 2002
197
0
0
US
hi,
I was wondering if vb has a function or if anyone knows an easy way to do this?

Lets say I have a number.For example lets use the number " 123456789 ". How can I get vb to take only a certain digit. Like I just want the first 5 digits. So it would be like this, " 12345 ". Thankx in advance.
 
To get the first 5 digits ...

dim lngNumber as long

lngNumber = left("123456789", 5)

I'm not sure if this is what you are after because your post isn't clear about what you are trying to do?

Transcend
[gorgeous]
 
Dim NumString, MyString as String
NumString = "123456789"
MyString = Left(NumString,5)

The variable MyString will equal "12345"
 
Hi,
Thanksyou all for helping me out. This is what I was aftering. I love vb. It has so many useful functions.
Again thankx.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top