Chris Macro
Well-known Member
- Joined
- Nov 2, 2011
- Messages
- 1,345
- Office Version
- 365
- Platform
- Windows
I have a userform created with two dropdown boxes. I want the contents in the 2nd box to change based on what the first box says. I created the below "Change Event" to code the possible outcomes. I find that if I change the 1st box initially the 2nd box will load the correct contents. However, if I go to change the 1st box a second time the 2nd box keeps the previously loaded information. Am I missing something?
<font face=Calibri><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> userform_Initialize()<br><br><SPAN style="color:#007F00">'Drop down box options for Statements</SPAN><br> <SPAN style="color:#00007F">With</SPAN> Me.Statement<br> .AddItem "Assets"<br> .AddItem "Liabilities"<br> .AddItem "Income Stmt"<br> .AddItem "Income Stmt (QtoQ)"<br> .AddItem "Income Stmt (MtoM)"<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN><br><br><SPAN style="color:#007F00">'Default setting for the Year</SPAN><br> Start_Year = Year(Date)<br> End_Year = Year(Date)<br> <br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br><br><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> Statement_Change()<br><br><SPAN style="color:#00007F">If</SPAN> Statement = "Assets" <SPAN style="color:#00007F">Then</SPAN><br> <SPAN style="color:#00007F">With</SPAN> Me.Account<br> .AddItem "** 111000 CASH AND CASH EQUIVALENTS"<br> .AddItem "*** 114000 NET ACCOUNT RECEIVABLES"<br> .AddItem "** 117000 TOTAL INVENTORIES"<br> .AddItem "** 118000 TOTAL OTHER CURRENT ASSETS"<br> .AddItem "**** 119999 Total Current Assets"<br> .AddItem "* 130011 INVESTMENT IN SUBSIDIARIES"<br> .AddItem "** 120000 TOTAL PROPERTY, PLANT AND EQUIPME"<br> .AddItem "** 133000 TOTAL INTANGIBLE AND OTHER ASSETS"<br> .AddItem "***** 100000 TOTAL ASSETS"<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN><br><br><SPAN style="color:#00007F">ElseIf</SPAN> Statement = "Liabilities" <SPAN style="color:#00007F">Then</SPAN><br> <SPAN style="color:#00007F">With</SPAN> Me.Account<br> .AddItem "** 211000 TOTAL ACCOUNTS PAYABLE"<br> .AddItem "** 213000 TOTAL ACCRUED EXPENSES"<br> .AddItem "* 215011 CURRENT PORTION OF LONG TERM DEBT"<br> .AddItem "*** 210000 TOTAL CURRENT LIABILITIES"<br> .AddItem "* 221011 LONG TERM DEBT"<br> .AddItem "** 223000 OTHER LONG TERM OBLIGATIONS"<br> .AddItem "* 223500 LIABILITIES SUBJECT TO COMPROMISE"<br> .AddItem "**** TOTAL LIABILITIES"<br> .AddItem "* 231111 COMMON STOCK"<br> .AddItem "* 235011 ADDITIONAL PAID IN CAPITAL"<br> .AddItem "** 236000 TOTAL ACCUMULATED DEFICIT"<br> .AddItem "* 234013 ACCUM.OTHER COMPREHENSIVE INCOME"<br> .AddItem "*** 230000 TOTAL STOCKHOLDER'S EQUITY"<br> .AddItem "***** 200000 TOTAL LIABILITIES AND EQUITY"<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN><br> <br><SPAN style="color:#00007F">ElseIf</SPAN> Statement = "Income Stmt" <SPAN style="color:#00007F">Or</SPAN> Statement = "Income Stmt (QtoQ)" <SPAN style="color:#00007F">Or</SPAN> Statement = "Income Stmt (MtoM)" <SPAN style="color:#00007F">Then</SPAN><br> <SPAN style="color:#00007F">With</SPAN> Me.Account<br> .AddItem "COGS** Net Sales"<br> .AddItem "SG&A*** Total Cost of Goods Sold"<br> .AddItem "SG&A** Total SG&A"<br> .AddItem "SG&A** Interest Expense"<br> .AddItem "SG&A** Other (Income) Expense, net"<br> .AddItem "SG&A**** (Income) Loss Before Reorg Items & Tax"<br> .AddItem "SG&A***** (Income) Loss Before Inc Taxes (Benefit)"<br> .AddItem "SG&A** Income Tax Expense"<br> .AddItem "0****** Net Income"<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN><br> <br><SPAN style="color:#00007F">Else</SPAN><br> MsgBox "Please select a Statement from the dropdown menu."<br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br><br>End <SPAN style="color:#00007F">Sub</SPAN></FONT>
<font face=Calibri><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> userform_Initialize()<br><br><SPAN style="color:#007F00">'Drop down box options for Statements</SPAN><br> <SPAN style="color:#00007F">With</SPAN> Me.Statement<br> .AddItem "Assets"<br> .AddItem "Liabilities"<br> .AddItem "Income Stmt"<br> .AddItem "Income Stmt (QtoQ)"<br> .AddItem "Income Stmt (MtoM)"<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN><br><br><SPAN style="color:#007F00">'Default setting for the Year</SPAN><br> Start_Year = Year(Date)<br> End_Year = Year(Date)<br> <br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br><br><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> Statement_Change()<br><br><SPAN style="color:#00007F">If</SPAN> Statement = "Assets" <SPAN style="color:#00007F">Then</SPAN><br> <SPAN style="color:#00007F">With</SPAN> Me.Account<br> .AddItem "** 111000 CASH AND CASH EQUIVALENTS"<br> .AddItem "*** 114000 NET ACCOUNT RECEIVABLES"<br> .AddItem "** 117000 TOTAL INVENTORIES"<br> .AddItem "** 118000 TOTAL OTHER CURRENT ASSETS"<br> .AddItem "**** 119999 Total Current Assets"<br> .AddItem "* 130011 INVESTMENT IN SUBSIDIARIES"<br> .AddItem "** 120000 TOTAL PROPERTY, PLANT AND EQUIPME"<br> .AddItem "** 133000 TOTAL INTANGIBLE AND OTHER ASSETS"<br> .AddItem "***** 100000 TOTAL ASSETS"<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN><br><br><SPAN style="color:#00007F">ElseIf</SPAN> Statement = "Liabilities" <SPAN style="color:#00007F">Then</SPAN><br> <SPAN style="color:#00007F">With</SPAN> Me.Account<br> .AddItem "** 211000 TOTAL ACCOUNTS PAYABLE"<br> .AddItem "** 213000 TOTAL ACCRUED EXPENSES"<br> .AddItem "* 215011 CURRENT PORTION OF LONG TERM DEBT"<br> .AddItem "*** 210000 TOTAL CURRENT LIABILITIES"<br> .AddItem "* 221011 LONG TERM DEBT"<br> .AddItem "** 223000 OTHER LONG TERM OBLIGATIONS"<br> .AddItem "* 223500 LIABILITIES SUBJECT TO COMPROMISE"<br> .AddItem "**** TOTAL LIABILITIES"<br> .AddItem "* 231111 COMMON STOCK"<br> .AddItem "* 235011 ADDITIONAL PAID IN CAPITAL"<br> .AddItem "** 236000 TOTAL ACCUMULATED DEFICIT"<br> .AddItem "* 234013 ACCUM.OTHER COMPREHENSIVE INCOME"<br> .AddItem "*** 230000 TOTAL STOCKHOLDER'S EQUITY"<br> .AddItem "***** 200000 TOTAL LIABILITIES AND EQUITY"<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN><br> <br><SPAN style="color:#00007F">ElseIf</SPAN> Statement = "Income Stmt" <SPAN style="color:#00007F">Or</SPAN> Statement = "Income Stmt (QtoQ)" <SPAN style="color:#00007F">Or</SPAN> Statement = "Income Stmt (MtoM)" <SPAN style="color:#00007F">Then</SPAN><br> <SPAN style="color:#00007F">With</SPAN> Me.Account<br> .AddItem "COGS** Net Sales"<br> .AddItem "SG&A*** Total Cost of Goods Sold"<br> .AddItem "SG&A** Total SG&A"<br> .AddItem "SG&A** Interest Expense"<br> .AddItem "SG&A** Other (Income) Expense, net"<br> .AddItem "SG&A**** (Income) Loss Before Reorg Items & Tax"<br> .AddItem "SG&A***** (Income) Loss Before Inc Taxes (Benefit)"<br> .AddItem "SG&A** Income Tax Expense"<br> .AddItem "0****** Net Income"<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN><br> <br><SPAN style="color:#00007F">Else</SPAN><br> MsgBox "Please select a Statement from the dropdown menu."<br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br><br>End <SPAN style="color:#00007F">Sub</SPAN></FONT>