Solved

Posted on 2003-03-03
Medium Priority
134 Views
Hi,

Dim sVar As String, iVar As Integer
sVar = “A 1-12-15”

What is the function (or code) which lets iVar = 15
(I mean the last number after “-“ , this number should be any number from 1 to 999999)

thanx
0
Question by:asns
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
1 Comment

LVL 6

Accepted Solution

marconovaro earned 200 total points
ID: 8056539

Here it is:

Dim sVar As String, iVar As Long

sVar = "A 1-12-356425"

iVar = Val(Right\$(sVar, Len(sVar) - InStrRev(sVar, "-", , vbTextCompare)))

End Sub

Please note that you'll need a long variable to store 999999... :)

M
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
###### Suggested Courses
Course of the Month14 days, 16 hours left to enroll