Using a userform to capture search data that generates a graph.

KimberlyHeart

New Member
Joined
Mar 17, 2016
Messages
19
I have a spreadsheet of data which is updated every month. There are Major categories of data (Football, Baseball, Basketball, Soccer, etc.) as well as Minor categories of data under each of those (First, Second, Third, Fourth...). I need to be able to prompt the user (userform?) for search criteria that then generates a graph. For example, the user selects "Football, Second, from January 2010 through December 2012" and a bar/line graph of that data is created. I plan to attach this macro/vba code to a button that simply says "Generate a graph". Below is what my data looks like. Can someone here get me started on the right path?

Code:
[TABLE="width: 1202"]
<tbody>[TR]
[TD]Monthly Data[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]ACTIVITY[/TD]
[TD]BASEBALL[/TD]
[TD]BASEBALL[/TD]
[TD]BASEBALL[/TD]
[TD]BASEBALL[/TD]
[TD]FOOTBALL[/TD]
[TD]FOOTBALL[/TD]
[TD]FOOTBALL[/TD]
[TD]FOOTBALL[/TD]
[TD]BASKETBALL[/TD]
[TD]BASKETBALL[/TD]
[TD]BASKETBALL[/TD]
[TD]BASKETBALL[/TD]
[/TR]
[TR]
[TD]SIGNUPS[/TD]
[TD]FIRST[/TD]
[TD]SECOND[/TD]
[TD]THIRD[/TD]
[TD]FOURTH[/TD]
[TD]FIRST[/TD]
[TD]SECOND[/TD]
[TD]THIRD[/TD]
[TD]FOURTH[/TD]
[TD]FIRST[/TD]
[TD]SECOND[/TD]
[TD]THIRD[/TD]
[TD]FOURTH[/TD]
[/TR]
[TR]
[TD="align: right"]2006[/TD]
[TD="align: right"]5144[/TD]
[TD="align: right"]617[/TD]
[TD="align: right"]37[/TD]
[TD="align: right"]1223[/TD]
[TD="align: right"]644[/TD]
[TD="align: right"]1633[/TD]
[TD="align: right"]160[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]199[/TD]
[TD="align: right"]167[/TD]
[TD="align: right"]1684[/TD]
[TD="align: right"]661[/TD]
[/TR]
[TR]
[TD]Feb.[/TD]
[TD="align: right"]5297[/TD]
[TD="align: right"]572[/TD]
[TD="align: right"]36[/TD]
[TD="align: right"]784[/TD]
[TD="align: right"]576[/TD]
[TD="align: right"]1568[/TD]
[TD="align: right"]167[/TD]
[TD="align: right"]13[/TD]
[TD="align: right"]96[/TD]
[TD="align: right"]161[/TD]
[TD="align: right"]1673[/TD]
[TD="align: right"]513[/TD]
[/TR]
[TR]
[TD]Mar.[/TD]
[TD="align: right"]5538[/TD]
[TD="align: right"]692[/TD]
[TD="align: right"]47[/TD]
[TD="align: right"]979[/TD]
[TD="align: right"]681[/TD]
[TD="align: right"]1486[/TD]
[TD="align: right"]192[/TD]
[TD="align: right"]21[/TD]
[TD="align: right"]101[/TD]
[TD="align: right"]183[/TD]
[TD="align: right"]1764[/TD]
[TD="align: right"]590[/TD]
[/TR]
[TR]
[TD]Apr.[/TD]
[TD="align: right"]5655[/TD]
[TD="align: right"]594[/TD]
[TD="align: right"]54[/TD]
[TD="align: right"]832[/TD]
[TD="align: right"]587[/TD]
[TD="align: right"]1436[/TD]
[TD="align: right"]166[/TD]
[TD="align: right"]20[/TD]
[TD="align: right"]117[/TD]
[TD="align: right"]167[/TD]
[TD="align: right"]1759[/TD]
[TD="align: right"]656[/TD]
[/TR]
[TR]
[TD]May[/TD]
[TD="align: right"]5433[/TD]
[TD="align: right"]647[/TD]
[TD="align: right"]46[/TD]
[TD="align: right"]596[/TD]
[TD="align: right"]655[/TD]
[TD="align: right"]1408[/TD]
[TD="align: right"]198[/TD]
[TD="align: right"]24[/TD]
[TD="align: right"]128[/TD]
[TD="align: right"]194[/TD]
[TD="align: right"]1810[/TD]
[TD="align: right"]564[/TD]
[/TR]
[TR]
[TD]June[/TD]
[TD="align: right"]5310[/TD]
[TD="align: right"]627[/TD]
[TD="align: right"]64[/TD]
[TD="align: right"]582[/TD]
[TD="align: right"]609[/TD]
[TD="align: right"]1323[/TD]
[TD="align: right"]182[/TD]
[TD="align: right"]29[/TD]
[TD="align: right"]91[/TD]
[TD="align: right"]177[/TD]
[TD="align: right"]1784[/TD]
[TD="align: right"]564[/TD]
[/TR]
[TR]
[TD]July[/TD]
[TD="align: right"]5590[/TD]
[TD="align: right"]459[/TD]
[TD="align: right"]44[/TD]
[TD="align: right"]987[/TD]
[TD="align: right"]556[/TD]
[TD="align: right"]1200[/TD]
[TD="align: right"]164[/TD]
[TD="align: right"]35[/TD]
[TD="align: right"]35[/TD]
[TD="align: right"]159[/TD]
[TD="align: right"]1734[/TD]
[TD="align: right"]606[/TD]
[/TR]
[TR]
[TD]Aug[/TD]
[TD="align: right"]5464[/TD]
[TD="align: right"]656[/TD]
[TD="align: right"]56[/TD]
[TD="align: right"]654[/TD]
[TD="align: right"]644[/TD]
[TD="align: right"]1036[/TD]
[TD="align: right"]211[/TD]
[TD="align: right"]22[/TD]
[TD="align: right"]59[/TD]
[TD="align: right"]223[/TD]
[TD="align: right"]1760[/TD]
[TD="align: right"]590[/TD]
[/TR]
[TR]
[TD]Sep.[/TD]
[TD="align: right"]5400[/TD]
[TD="align: right"]579[/TD]
[TD="align: right"]49[/TD]
[TD="align: right"]662[/TD]
[TD="align: right"]587[/TD]
[TD="align: right"]951[/TD]
[TD="align: right"]178[/TD]
[TD="align: right"]20[/TD]
[TD="align: right"]95[/TD]
[TD="align: right"]180[/TD]
[TD="align: right"]1709[/TD]
[TD="align: right"]513[/TD]
[/TR]
[TR]
[TD]Oct.[/TD]
[TD="align: right"]5385[/TD]
[TD="align: right"]635[/TD]
[TD="align: right"]47[/TD]
[TD="align: right"]637[/TD]
[TD="align: right"]654[/TD]
[TD="align: right"]918[/TD]
[TD="align: right"]186[/TD]
[TD="align: right"]33[/TD]
[TD="align: right"]235[/TD]
[TD="align: right"]201[/TD]
[TD="align: right"]1667[/TD]
[TD="align: right"]564[/TD]
[/TR]
[TR]
[TD]Nov.[/TD]
[TD="align: right"]5335[/TD]
[TD="align: right"]636[/TD]
[TD="align: right"]37[/TD]
[TD="align: right"]719[/TD]
[TD="align: right"]646[/TD]
[TD="align: right"]958[/TD]
[TD="align: right"]180[/TD]
[TD="align: right"]17[/TD]
[TD="align: right"]182[/TD]
[TD="align: right"]196[/TD]
[TD="align: right"]1617[/TD]
[TD="align: right"]540[/TD]
[/TR]
[TR]
[TD]Dec.[/TD]
[TD="align: right"]5394[/TD]
[TD="align: right"]564[/TD]
[TD="align: right"]51[/TD]
[TD="align: right"]563[/TD]
[TD="align: right"]658[/TD]
[TD="align: right"]1127[/TD]
[TD="align: right"]194[/TD]
[TD="align: right"]18[/TD]
[TD="align: right"]207[/TD]
[TD="align: right"]193[/TD]
[TD="align: right"]1617[/TD]
[TD="align: right"]513[/TD]
[/TR]
[TR]
[TD="align: right"]2007[/TD]
[TD="align: right"]5708[/TD]
[TD="align: right"]642[/TD]
[TD="align: right"]87[/TD]
[TD="align: right"]953[/TD]
[TD="align: right"]606[/TD]
[TD="align: right"]1464[/TD]
[TD="align: right"]192[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]535[/TD]
[TD="align: right"]205[/TD]
[TD="align: right"]1653[/TD]
[TD="align: right"]600[/TD]
[/TR]
[TR]
[TD]Feb.[/TD]
[TD="align: right"]5724[/TD]
[TD="align: right"]558[/TD]
[TD="align: right"]64[/TD]
[TD="align: right"]801[/TD]
[TD="align: right"]581[/TD]
[TD="align: right"]1515[/TD]
[TD="align: right"]233[/TD]
[TD="align: right"]17[/TD]
[TD="align: right"]233[/TD]
[TD="align: right"]220[/TD]
[TD="align: right"]1659[/TD]
[TD="align: right"]546[/TD]
[/TR]
[TR]
[TD]Mar.[/TD]
[TD="align: right"]5578[/TD]
[TD="align: right"]697[/TD]
[TD="align: right"]42[/TD]
[TD="align: right"]706[/TD]
[TD="align: right"]718[/TD]
[TD="align: right"]1349[/TD]
[TD="align: right"]228[/TD]
[TD="align: right"]22[/TD]
[TD="align: right"]84[/TD]
[TD="align: right"]223[/TD]
[TD="align: right"]1746[/TD]
[TD="align: right"]600[/TD]
[/TR]
[TR]
[TD]April[/TD]
[TD="align: right"]6010[/TD]
[TD="align: right"]659[/TD]
[TD="align: right"]41[/TD]
[TD="align: right"]1241[/TD]
[TD="align: right"]662[/TD]
[TD="align: right"]1229[/TD]
[TD="align: right"]214[/TD]
[TD="align: right"]41[/TD]
[TD="align: right"]76[/TD]
[TD="align: right"]195[/TD]
[TD="align: right"]1719[/TD]
[TD="align: right"]573[/TD]
[/TR]
[TR]
[TD]May[/TD]
[TD="align: right"]5971[/TD]
[TD="align: right"]692[/TD]
[TD="align: right"]46[/TD]
[TD="align: right"]1026[/TD]
[TD="align: right"]687[/TD]
[TD="align: right"]947[/TD]
[TD="align: right"]207[/TD]
[TD="align: right"]26[/TD]
[TD="align: right"]-57[/TD]
[TD="align: right"]222[/TD]
[TD="align: right"]1773[/TD]
[TD="align: right"]600[/TD]
[/TR]
[TR]
[TD]June[/TD]
[TD="align: right"]5915[/TD]
[TD="align: right"]650[/TD]
[TD="align: right"]35[/TD]
[TD="align: right"]728[/TD]
[TD="align: right"]662[/TD]
[TD="align: right"]758[/TD]
[TD="align: right"]191[/TD]
[TD="align: right"]28[/TD]
[TD="align: right"]-6[/TD]
[TD="align: right"]188[/TD]
[TD="align: right"]1743[/TD]
[TD="align: right"]570[/TD]
[/TR]
[TR]
[TD]July[/TD]
[TD="align: right"]5760[/TD]
[TD="align: right"]642[/TD]
[TD="align: right"]29[/TD]
[TD="align: right"]664[/TD]
[TD="align: right"]647[/TD]
[TD="align: right"]616[/TD]
[TD="align: right"]136[/TD]
[TD="align: right"]18[/TD]
[TD="align: right"]27[/TD]
[TD="align: right"]146[/TD]
[TD="align: right"]1677[/TD]
[TD="align: right"]507[/TD]
[/TR]
[TR]
[TD]Aug[/TD]
[TD="align: right"]5476[/TD]
[TD="align: right"]765[/TD]
[TD="align: right"]40[/TD]
[TD="align: right"]660[/TD]
[TD="align: right"]755[/TD]
[TD="align: right"]474[/TD]
[TD="align: right"]144[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]23[/TD]
[TD="align: right"]147[/TD]
[TD="align: right"]1669[/TD]
[TD="align: right"]591[/TD]
[/TR]
[TR]
[TD]Sep.[/TD]
[TD="align: right"]5318[/TD]
[TD="align: right"]683[/TD]
[TD="align: right"]51[/TD]
[TD="align: right"]600[/TD]
[TD="align: right"]672[/TD]
[TD="align: right"]401[/TD]
[TD="align: right"]125[/TD]
[TD="align: right"]9[/TD]
[TD="align: right"]58[/TD]
[TD="align: right"]131[/TD]
[TD="align: right"]1641[/TD]
[TD="align: right"]543[/TD]
[/TR]
[TR]
[TD]Oct.[/TD]
[TD="align: right"]5227[/TD]
[TD="align: right"]715[/TD]
[TD="align: right"]31[/TD]
[TD="align: right"]747[/TD]
[TD="align: right"]736[/TD]
[TD="align: right"]388[/TD]
[TD="align: right"]125[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]107[/TD]
[TD="align: right"]120[/TD]
[TD="align: right"]1747[/TD]
[TD="align: right"]613[/TD]
[/TR]
[TR]
[TD]Nov.[/TD]
[TD="align: right"]5001[/TD]
[TD="align: right"]719[/TD]
[TD="align: right"]27[/TD]
[TD="align: right"]650[/TD]
[TD="align: right"]733[/TD]
[TD="align: right"]380[/TD]
[TD="align: right"]126[/TD]
[TD="align: right"]9[/TD]
[TD="align: right"]126[/TD]
[TD="align: right"]134[/TD]
[TD="align: right"]1683[/TD]
[TD="align: right"]527[/TD]
[/TR]
[TR]
[TD]Dec.[/TD]
[TD="align: right"]4797[/TD]
[TD="align: right"]601[/TD]
[TD="align: right"]50[/TD]
[TD="align: right"]501[/TD]
[TD="align: right"]583[/TD]
[TD="align: right"]504[/TD]
[TD="align: right"]104[/TD]
[TD="align: right"]18[/TD]
[TD="align: right"]193[/TD]
[TD="align: right"]96[/TD]
[TD="align: right"]1556[/TD]
[TD="align: right"]416[/TD]
[/TR]
[TR]
[TD="align: right"]2008[/TD]
[TD="align: right"]4596[/TD]
[TD="align: right"]762[/TD]
[TD="align: right"]39[/TD]
[TD="align: right"]611[/TD]
[TD="align: right"]774[/TD]
[TD="align: right"]634[/TD]
[TD="align: right"]104[/TD]
[TD="align: right"]28[/TD]
[TD="align: right"]221[/TD]
[TD="align: right"]94[/TD]
[TD="align: right"]1597[/TD]
[TD="align: right"]654[/TD]
[/TR]
[TR]
[TD]Feb.[/TD]
[TD="align: right"]4126[/TD]
[TD="align: right"]692[/TD]
[TD="align: right"]28[/TD]
[TD="align: right"]443[/TD]
[TD="align: right"]704[/TD]
[TD="align: right"]652[/TD]
[TD="align: right"]116[/TD]
[TD="align: right"]13[/TD]
[TD="align: right"]152[/TD]
[TD="align: right"]126[/TD]
[TD="align: right"]1694[/TD]
[TD="align: right"]624[/TD]
[/TR]
[TR]
[TD]Mar.[/TD]
[TD="align: right"]3941[/TD]
[TD="align: right"]689[/TD]
[TD="align: right"]46[/TD]
[TD="align: right"]564[/TD]
[TD="align: right"]671[/TD]
[TD="align: right"]807[/TD]
[TD="align: right"]121[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]284[/TD]
[TD="align: right"]128[/TD]
[TD="align: right"]1906[/TD]
[TD="align: right"]627[/TD]
[/TR]
</tbody>[/TABLE]
 

Some videos you may like

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

Watch MrExcel Video

Forum statistics

Threads
1,122,511
Messages
5,596,581
Members
414,079
Latest member
Frills

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top