![]() |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 01:52 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com