VBA To Display Scenarios Based On Combo Box Selection
Feb 24, 2009
I just want to create a combo box that will allow my manager --- not so good at using menu commands or the scenario manager --- to choose one of five different budget scenarios. I can't seem to get the actual scenarios to change when the selection is made from the combo-box.
I have attached a portion of an excel file I am using at the moment. What I require is a piece of VBA code which will allow me to copy selected data based on a combo box selection. What needs to happen is this :-
If the selection in the "Index" worksheet combo box related to "Month" in cell G19 is for instance "December", I would like the macro to compare this cell value to the cell values in cells C96, C124, C152, C180, C209, C236, C263 and C290 in the "Tech Services" worksheet and where the values match.......copy the commentary (Range C126:Z147 in December's case) to the range C34:Z55.
I'm trying to replicate the VBA code for displaying scenarios using a drop-down list that I found on this website: http://www.tvmcalcs.com/blog/comment...rop_down_list/
However, I've not quite been able to get it to work on my worksheet. This is my
I have a spreadsheet with 2 combo boxes - Combobox 1 enables a user to specify if they want to look at the data on the sheet by week or month - it has just 2 options - "select by week" or "select by month"
The list in combobox 2 changes based on the selection in combobox1 - so if you select "select by week" , a date list by week shows up.
Combobox 2 is supposed to run a macro which updates some backend pivot tables. there are 2 types of backend pivottable - weekly tables and monthly tables.
What i am not sure about is how to get the selections in combobox 2 to run either the weekly macro or the monthly macro based on if combobox1 is set to week or month ...?
I want to populate the values of two textboxes that we will call TextBox5 and TextBox6 from columns W and X of a spreadsheet called "PowerAnalysis" when a selection is made form ComboBox5.
The ComboBox5 works perfectly now. I just need it to populate the other two text boxes.
All the data resides in the same row on the same sheet of PowerAnalysis when the selection is made in ComboBox5.
I hope I have been able to give a clear picture of what I am wanting to do.
I am trying to use a userform ( Combo Box) to update my named cell "Aircraft1" then based on the value selected change the color of an object.
The code works great if I manually enter the value in the cell "Aircraft1", however if the dropdown list selects the value the object does not update its color.
Is there a way to update the cell via a combo box, and then have the VB code change the color of the object?
This is my
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Target, Range("Aircraft1")) Is Nothing Then Exit Sub ActiveSheet.Shapes("Arrow1").Select
With Range("Aircraft1")
If .Value = 1 Then ActiveSheet.Shapes("Arrow1").Select Selection.ShapeRange.Fill.Visible = msoTrue Selection.ShapeRange.Fill.Solid Selection.ShapeRange.Fill.ForeColor.SchemeColor = 17
I have created a User Form that has been tested and is working properly. Now my last step is to do the following:
I would like to Display the User Form (coded as CommRM) if in Column C (can be any cell as it is a large worksheet) someone selects "Retail News" from the drop down option.
The code that I have been able to create so far is below. The problem is that when I select Retail News from a drop down in Column C the user form does not appear.
VB:
Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Range (C14, C3333).Text = "Retail News" Then Call UserForm_Initialize End Sub Private Sub UserForm_Initialize() Load CommRM CommRM.Show End Sub
I'm wondering how I could display information based on the user input through dropdown selection. I know how to make a dropdown-list already.
Example: A1 has a dropdownlist with Apple and Banana in it. If I select banana then I want B1 to display "8" and if I select Banana I want B1 to display "4".
I am trying to display a formatted formula (combination of greek characters, superscripts, subscripts, bold, italics, etc...) based on a selected input. I have a selection cell with a drop down offering the choice of 4 difference scenarios. I want to display the resulting formatted formula depending on which scenario is selected (the formula is difference depending on the selection, as well as perform the calculation.
The calculation works fine, but I cannot figure out how to show the formatted formula. The selection works using IF statements, or VLOOKUP, but does not bring the formatting across. How can I do this?
I want is to happen is that depending on which option a user selects from the drop down box (a total of 10 options), a select number of rows and columns should be hidden/visible (as you'll see from the below code..)
The other issue I'm having is that with the below code, the workbook seems to be very "busy" constantly calculating something or the other. I need the Sub to be run ONLY when a user changes a selection in the combo box, but it appears that every few seconds the workbook will be calculating something.
Finally, I introduced the GoTo Endo line after every option (1 to 10) to try and speed up the Sub when a user makes a selection, but this appears to make no differnce - it still takes forever to run the Sub.
I am using 3 combo boxes to select the year, month and day for a scheduling worksheet. Each combo box is linked to a cell which is 'named' accordingly.
When I select the year and day, the calculations in the worksheet work. But when I select the month, the calculations will not work.
If I enter the month number into the linked cell using the keyboard and press 'enter', the worksheet calculates perfectly. Only when the month number is entered into the linked cell by selecting in with the combo box, it does not work.
BTW: I am intentionally trying to avoid using macros for 'security' reasons.
In my workbook i have worksheets that are named 01-Jan-2008,15-jan-2008,30-jan-2008...and i have almost 50 for each year.from 2007 to 2009. I have created a userform where i have a Year combobox with values 2007,2008,2009 and an ok button then in the same form, i have a listbox and an Ok button and a back button.
i want the user to be able to pick the Year from the combobox. once he specifies the year, the worksheets corresponding to that year should appear in the listbox...instead of populating it with all the 100+ wksheets i want the search narrowed down.
I have 180 different images to display with 60 different situations. This means that for every combination of 4 variables, there are 3 images. What I have set up right now are combo-boxes where a user would be able to select the situation which best suits them within the four variables. What I would like to happen would be to have the 3 images pertaining to the chosen variables appear within the worksheet. These images could be put within a worksheet or accessed through a folder.
Been doing pretty good up till now but I can not figure out how to get a combo box in the first blank cell of column A. I am using the named range 'Units' and there are almost 900 of them so I need the combo box.
Im using code from website: http://www.contextures.com/xlDataVal11.html
to display a combobox when I double click any cell that contains a validation list in it. I'm not great with VBA so I am having problems finding what each part of the code does. This is causing problems for another bit of code that I use to display a msgbox when certain values are selected from the list.
The MsgBox shows up great when I select an item from the validation list but does not work at all when I select the same item from the double-clicked combo box. It would be great if I could get the MsgBox to work both ways. This is the code that displays the MsgBox when target value is selected from list
Private Sub Worksheet_Change(ByVal Target As Range) Select Case Target.AddressLocal(False, False) Case Is = "B4", "B5", "B6", "B7", "B8", "B9", "B10", "B11", "B12" If Target.Value = "H" Then MsgBox "This is a pop for extra information. Savvy?", vbYesNo, "Yo!" End If End Select End Sub...............
I know how to turn the autocomplete on and off but I donīt have a clue where I configure the data range or the cells to display the list when the combo box is clicked.
I am assuming that this is done in the Edit mode at "linkedCell" and LisfFillRange ... yet I canīt get this to work.
If a user selects certain options from a drop down list created by cell verification (from list), is it possible to display an input box and have the resulting input populate on another worksheet in the workbook? I have an attendance template I'm working with and if a user selects OT (Over Time) then a input box is displayed prompting for how many hours. The overtime is then tracked on another worksheet.
I want to have a drop down list in a cell so that the value in the cell can be only selected from two columns of data. Additionally once the data from the first column has been selected I want to be able to limit the inputs the user can select from in the second column.
e.g. In cell C115 I want to have the value BDS05.
I want to be able to select the value BDS from a drop down list of values and once that value has been selected I want to be able select 05 from a list of values from 01 to 14 If I select BCS as the first value then I want the second set of values to be limited to 01 to 02 etc.
I have read about combo boxes and list boxes and I'm a bit confused about the best way to achieve this (or even if I can).
What I am trying to do is a formula for two different 'if' scenarios that will return one value for one answer and another value for the other. They are not numbers, they are text.
For example:
if the cell contains 'pcs' value would = no if the cell contains a dollar amt value would = yes
how i am able to change scenarios using data validation. e.g I have 3 scenarios, i want to be able to show different scenarios using the data validation button. Also in the 2003 excel version i am able to have a scenario toolbar shortcut, how can i have this toolbar shorcut in excel 2007?
2008 Jan Feb Mar.... 2009 Jan Feb Mar..... 2010 Jan Feb Mar..................... eggs 15 25 35......... eggs 8 11 15............ eggs 96 15 6...................... milk 10 15 20............ milk 65 32 36........... milk 100 36 36...................... butter 5 20 1............ butter 8 18 15......... butter 8 5 45.....................
i want to be able to change values for each year using data validation/drop down list?
1 last question i also want to know how i can circle certain data for training purposes.
I am working with a catering form that someone else created at work. It has a drop down list of menu items available. Once an item is chosen, the item description pops up.
These descriptions are so much longer than anything else in the row (item name, qty, #, cost). Is there an option to make the full text temporarily visible by selecting the cell, and leave it cut off the rest of the time? I am trying to keep the form at one page.
I have a spreadsheet I work with which contains a formula that needs to take an item ID letter/number combo, substitute the preceeding letter(s) with leading zeros (if the initial numerical characters are fewer than 5) to make the result return a 5-digit number.
The original ID can be in several possible formats (beside each I will post the desired result): V7684 07684V366 00366V88 00088V60827 60827VS57871 57871VS67 00067
I have the following formula which works like a charm for all except the last example: =IF(LEN(K2)>5,(SUBSTITUTE(SUBSTITUTE(K2,"VS","),"V",")),(REPT("0",5-LEN(K2))&(SUBSTITUTE(SUBSTITUTE(K2,"VS","0"),"V","0"))))
If the first 2 characters are letters ("VS") and there are fewer than 5 numerical characters, the formula results in a 4-digit number, rather than 5. Using the above example, VS67 returns 0067 instead of 00067.
P.S. I just tried =IF(LEN(K2)>5,(SUBSTITUTE(SUBSTITUTE(K2,"VS",""),"V","")),(REPT("0",5-LEN(K2))&(SUBSTITUTE(SUBSTITUTE(K2,"VS","00"),"V","0")))) which only works when there are 3 or fewer numerical characters.
I want to use vlookup and pull the data from table1. But when the user selects Grand Total from the drop down, I want the data to be pulled from Table2. Please see attached for more clarification.
The form consists of 3 or 4 combo boxes and a few text boxes.
There are two worksheets "Data" and "ComboInfo".
Worksheet "ComboInfo" has 4 columns to represent the drop-down data.
I want the user to select a value in combo1. This will then repopulate and filter the list in combo2 with rows that matching combo1. I want to repeat the process for the other combo boxes.
Once the combo boxes are completed and a few additional textboxes the data needs to applied to the "Data" worksheet.
My main stumbling block is Filtering the Combo2.AddItem.