Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
I'd like to convert this case statement into an array select Case PropName Case "Name" ColNum = 1 Case "Address1" ColNum = 2 'more case statements end select instead PropNames = Array("Name", "Address1"....) colnum = <position of PropName in PropNames I used to know this - i am blanking out. Thanks for the help Regards Habib |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Something like?
Propnames = Array("Name", "Address1") PropName = "Address1" colnum = Application.Match(PropName, Propnames, 0) HTH "HSalim[MVP]" wrote: Hi I'd like to convert this case statement into an array select Case PropName Case "Name" ColNum = 1 Case "Address1" ColNum = 2 'more case statements end select instead PropNames = Array("Name", "Address1"....) colnum = <position of PropName in PropNames I used to know this - i am blanking out. Thanks for the help Regards Habib |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
dim res as variant
dim PropNames as variant dim PropName as string 'variant??? dim ColNum as long propnames = array("name","address1", "something","addressx") propname = "something" res = application.match(propname,propnames,0) if iserror(res) then msgbox "not found!" 'what else should be done? else colNum = res end if "HSalim[MVP]" wrote: Hi I'd like to convert this case statement into an array select Case PropName Case "Name" ColNum = 1 Case "Address1" ColNum = 2 'more case statements end select instead PropNames = Array("Name", "Address1"....) colnum = <position of PropName in PropNames I used to know this - i am blanking out. Thanks for the help Regards Habib -- Dave Peterson |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
DAve and Toppers,
Thanks for the immediate reply. That hit the spot. aaah! Regards Habib "Dave Peterson" wrote in message ... dim res as variant dim PropNames as variant dim PropName as string 'variant??? dim ColNum as long propnames = array("name","address1", "something","addressx") propname = "something" res = application.match(propname,propnames,0) if iserror(res) then msgbox "not found!" 'what else should be done? else colNum = res end if "HSalim[MVP]" wrote: Hi I'd like to convert this case statement into an array select Case PropName Case "Name" ColNum = 1 Case "Address1" ColNum = 2 'more case statements end select instead PropNames = Array("Name", "Address1"....) colnum = <position of PropName in PropNames I used to know this - i am blanking out. Thanks for the help Regards Habib -- Dave Peterson |