Instr problem


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
Gabriel_BrienzaAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
WizOfOzConnect With a Mentor Commented:
variableAA=split(mystring, " ")(0)
variableBB=split(mystring, " ")(1)

try this

0
 
WizOfOzCommented:
Why not use split?
variableAA=split (mystring," ")(0)
variableBB=split (mystring," ")(0)
0
 
WizOfOzCommented:
ops, xcuse me
variableBB=split (mystring," ")(1)
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
Gabriel_BrienzaAuthor Commented:
Hi there
it says script outof range
Any Ideas
0
 
Gabriel_BrienzaAuthor Commented:
Another thing,
Variable aa and variablebb can be of any length!
Thanks
Gabriel
0
 
WizOfOzCommented:
xcuse my last post
0
 
Gabriel_BrienzaAuthor Commented:
It works!!
Thanks
Gabriele
0
 
Gabriel_BrienzaAuthor Commented:
Actually it didnt work
Any further suggestions
Thanks
Gabriel
0
 
Gabriel_BrienzaAuthor Commented:
sorry it works actually
APOLOGIES
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.