Solved

Instr problem

Posted on 2002-04-18
9
199 Views
Last Modified: 2012-05-04

Hi Guys

I always had problem with instr


dim mystring as string
mystring="aa bb"

I want to get the in two separate variables aa and bb
basically anything from the start to the space and
anything from the space to the end

dim variableAA as string
variableAA=instr(????)
variableBB=instr(???)

can you help
Thanks
Gabriel
0
Comment
Question by:Gabriel_Brienza
  • 5
  • 4
9 Comments
 

Expert Comment

by:WizOfOz
ID: 6950994
Why not use split?
variableAA=split (mystring," ")(0)
variableBB=split (mystring," ")(0)
0
 

Expert Comment

by:WizOfOz
ID: 6950997
ops, xcuse me
variableBB=split (mystring," ")(1)
0
 

Author Comment

by:Gabriel_Brienza
ID: 6951018
Hi there
it says script outof range
Any Ideas
0
 

Accepted Solution

by:
WizOfOz earned 10 total points
ID: 6951020
variableAA=split(mystring, " ")(0)
variableBB=split(mystring, " ")(1)

try this

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:Gabriel_Brienza
ID: 6951021
Another thing,
Variable aa and variablebb can be of any length!
Thanks
Gabriel
0
 

Expert Comment

by:WizOfOz
ID: 6951022
xcuse my last post
0
 

Author Comment

by:Gabriel_Brienza
ID: 6951035
It works!!
Thanks
Gabriele
0
 

Author Comment

by:Gabriel_Brienza
ID: 6951145
Actually it didnt work
Any further suggestions
Thanks
Gabriel
0
 

Author Comment

by:Gabriel_Brienza
ID: 6951164
sorry it works actually
APOLOGIES
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Using "ScreenUpdating" 6 55
Adding to a VBA? 6 61
How to incorporate an error traping routing to existing code in VB6 11 39
Can we place a tooltip on the actual vb6 form 5 35
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now