+ Reply to Thread
Results 1 to 4 of 4

Moving a Variant to Array

  1. #1
    Ivan
    Guest

    Moving a Variant to Array

    I have a ComboBox with a following data (code and name):
    12345acb namenamenamenam
    123c namenamenamename

    and then I need to move only first data (code) to a variant in order to use
    in Vlookup. Is an option to move each characters and ending when find the
    first blank...? How I can make this?
    Thanks for your help.
    Ivan

  2. #2
    Dave Peterson
    Guest

    Re: Moving a Variant to Array

    dim myStr as string
    dim SpacePos as long
    myStr = "123c namenamenamename"

    spacepos = instr(1,mystr&" "," ")

    msgbox left(mystr,spacepos-1)

    might be a way to go about it.


    Ivan wrote:
    >
    > I have a ComboBox with a following data (code and name):
    > 12345acb namenamenamenam
    > 123c namenamenamename
    >
    > and then I need to move only first data (code) to a variant in order to use
    > in Vlookup. Is an option to move each characters and ending when find the
    > first blank...? How I can make this?
    > Thanks for your help.
    > Ivan


    --

    Dave Peterson

  3. #3
    Ivan
    Guest

    Re: Moving a Variant to Array

    Dave, thanks. Only a comment, because I need to change following sentence:
    spacepos = instr(1, mystr, " ", 1)
    With this change my sentence is working ok.
    Best regards,
    Iván


    "Dave Peterson" wrote:

    > dim myStr as string
    > dim SpacePos as long
    > myStr = "123c namenamenamename"
    >
    > spacepos = instr(1,mystr&" "," ")
    >
    > msgbox left(mystr,spacepos-1)
    >
    > might be a way to go about it.
    >
    >
    > Ivan wrote:
    > >
    > > I have a ComboBox with a following data (code and name):
    > > 12345acb namenamenamenam
    > > 123c namenamenamename
    > >
    > > and then I need to move only first data (code) to a variant in order to use
    > > in Vlookup. Is an option to move each characters and ending when find the
    > > first blank...? How I can make this?
    > > Thanks for your help.
    > > Ivan

    >
    > --
    >
    > Dave Peterson
    >


  4. #4
    Dave Peterson
    Guest

    Re: Moving a Variant to Array

    Oops.

    Thanks for the correction.

    Ivan wrote:
    >
    > Dave, thanks. Only a comment, because I need to change following sentence:
    > spacepos = instr(1, mystr, " ", 1)
    > With this change my sentence is working ok.
    > Best regards,
    > Iván
    >
    > "Dave Peterson" wrote:
    >
    > > dim myStr as string
    > > dim SpacePos as long
    > > myStr = "123c namenamenamename"
    > >
    > > spacepos = instr(1,mystr&" "," ")
    > >
    > > msgbox left(mystr,spacepos-1)
    > >
    > > might be a way to go about it.
    > >
    > >
    > > Ivan wrote:
    > > >
    > > > I have a ComboBox with a following data (code and name):
    > > > 12345acb namenamenamenam
    > > > 123c namenamenamename
    > > >
    > > > and then I need to move only first data (code) to a variant in order to use
    > > > in Vlookup. Is an option to move each characters and ending when find the
    > > > first blank...? How I can make this?
    > > > Thanks for your help.
    > > > Ivan

    > >
    > > --
    > >
    > > Dave Peterson
    > >


    --

    Dave Peterson

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1