![]() |
Combo Box Help
Hello! I am a little stuck on a project I am working on and a little new a macro programing... I have multiple macros that will search my spreadsheet, each on designed to search for a specific Name and copy the entire row relatin to that instance of that name to a new sheet along with all othe instances of that name. So, for instance, I can pull all the "Bobs" ou of my data and they will be stored on a new sheet. What I would like to do is have a Combo Box that displays all of th names where each name is linked to the specific Macro. So I can pul the box down, select "Bob" and the "Get Bob" macro runs, and if select "Dave" the "Get Dave" macro runs. The problem is I am unsure of how to do this... I can create the Comb Box, and assign a macro, but can only assign one macro, thus making i so that every name I choose uses "Get Bob"... :confused: Anyone know a way to possibly code the links to make it so that i works correctly? Or anything? Is what I want even possible? Cause I dont want a bunch of buttons i at all possible :( Thanks a bunch -- Gryswyn ----------------------------------------------------------------------- Gryswynd's Profile: http://www.excelforum.com/member.php...fo&userid=3655 View this thread: http://www.excelforum.com/showthread.php?threadid=56309 |
Combo Box Help
Sub MacroCaller()
Select Case ComboBox1.Value Case "Bob" Call GetBob Case "Dave" Call GetDave Case else Call Nobody End Select Does that help any? Die_Another_Day "Gryswynd" wrote in message ... Hello! I am a little stuck on a project I am working on and a little new at macro programing... I have multiple macros that will search my spreadsheet, each one designed to search for a specific Name and copy the entire row relating to that instance of that name to a new sheet along with all other instances of that name. So, for instance, I can pull all the "Bobs" out of my data and they will be stored on a new sheet. What I would like to do is have a Combo Box that displays all of the names where each name is linked to the specific Macro. So I can pull the box down, select "Bob" and the "Get Bob" macro runs, and if I select "Dave" the "Get Dave" macro runs. The problem is I am unsure of how to do this... I can create the Combo Box, and assign a macro, but can only assign one macro, thus making it so that every name I choose uses "Get Bob"... :confused: Anyone know a way to possibly code the links to make it so that it works correctly? Or anything? Is what I want even possible? Cause I dont want a bunch of buttons if at all possible :( Thanks a bunch! -- Gryswynd ------------------------------------------------------------------------ Gryswynd's Profile: http://www.excelforum.com/member.php...o&userid=36559 View this thread: http://www.excelforum.com/showthread...hreadid=563092 |
Combo Box Help
If all you macros perform similar functions, just pass the name. e.g.
Function FindData (argName as string) as boolean dim foundrange as range set foundrange=Range("rngData").Find(argName,,...etc) If Not foundrange is nothing then 'perform your actions based on foundrange FindData =true Else FindData = false End if Then in the Combobox1_Click event Dim RetVal as Boolean RetVal=FindData (Combobox1.Text) If RetVal=False then Msgbox "No data for " & Combobox1.Text NickHk "Gryswynd" wrote in message ... Hello! I am a little stuck on a project I am working on and a little new at macro programing... I have multiple macros that will search my spreadsheet, each one designed to search for a specific Name and copy the entire row relating to that instance of that name to a new sheet along with all other instances of that name. So, for instance, I can pull all the "Bobs" out of my data and they will be stored on a new sheet. What I would like to do is have a Combo Box that displays all of the names where each name is linked to the specific Macro. So I can pull the box down, select "Bob" and the "Get Bob" macro runs, and if I select "Dave" the "Get Dave" macro runs. The problem is I am unsure of how to do this... I can create the Combo Box, and assign a macro, but can only assign one macro, thus making it so that every name I choose uses "Get Bob"... :confused: Anyone know a way to possibly code the links to make it so that it works correctly? Or anything? Is what I want even possible? Cause I dont want a bunch of buttons if at all possible :( Thanks a bunch! -- Gryswynd ------------------------------------------------------------------------ Gryswynd's Profile: http://www.excelforum.com/member.php...o&userid=36559 View this thread: http://www.excelforum.com/showthread...hreadid=563092 |
All times are GMT +1. The time now is 04:05 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com