Function To Return Value Based On OptionButton Choice
Feb 3, 2008
Ihave 2 functions which are called in my main program which should return a value due to what the user selects on a userform using option buttons and check boxes.
Function getnum() As Integer
If userform1.OptionButton1.Value = True Then
getnum = 1
End If
If userform1.OptionButton1.Value = True Then
getnum = 3
End If
If userform1.OptionButton1.Value = True Then
getnum = 5
End If
End Function
Function getlevel() As Double
If userform1.CheckBox1.Value = True Then
getlevel = 1.2
End If.......................................
View 3 Replies
ADVERTISEMENT
Nov 8, 2006
I have the following code. I need the textbox values to pass to the cells when the option button (OB) is "moved away from"; that is, when I fill in the boxes while uner OB1, then select OB2, I want the values I put in to pass to the cells. Right now, the values passing to the cells listed under OB 1 are the values that are brought in under the enter event for OB2.
Private Sub OptionButton1_enter()
Me.TextBox1.Value = ActiveCell.Offset(0, 9).Value
Me.TextBox2.Value = ActiveCell.Offset(0, 10).Value
Me.TextBox3.Value = ActiveCell.Offset(0, 11).Value
Me.TextBox4.Value = ActiveCell.Offset(0, 12).Value
Me.TextBox5.Value = ActiveCell.Offset(0, 13).Value
Me.TextBox6.Value = ActiveCell.Offset(0, 14).Value
Me.TextBox7.Value = ActiveCell.Offset(0, 15).Value
Me.TextBox8.Value = ActiveCell.Offset(0, 16).Value
End Sub
View 9 Replies
View Related
Feb 6, 2008
I have two option buttons on a userform and when the user selects an option button I would like it to stay selected when the userform is called again.
View 2 Replies
View Related
Nov 14, 2006
I have created a cascading data validation list, and I would like to have an adjacent cell auto populate according to the dropdown selection.
Data Eg:
Oranges 1100
Apples 1101
Pears 1102
Grapes 1103
If the user selects "Pears" from the dropdown list, I would like the adjacent cell to populate with the numerical code for "pears", in this case 1102. I am designing a new expense report form at the office, and I am at a standstill with this problem.
View 2 Replies
View Related
Feb 12, 2008
My Main data in my workbook is copied from another workbook. From there it is sorted into separate worksheets for each customer via a macro. I want to be able to set something up so that I can list the customers and then list job descriptions, products and pricing from the correct sheet and return the selected data back to its original form in sheet1.
I am also trying to run the macro that sorts the data in this workbook from another workbook.
I have attached the file so you can see what i am trying to explain.
View 9 Replies
View Related
Feb 5, 2008
I have a user form with a group of several option buttons. When an optionbutton is selected, programatically, I want a worksheet's named column to be parsed through to find unique entries and then have those entries passed to the form's combobox. I've spent the last hour searching for an answer but to no success
View 3 Replies
View Related
Dec 11, 2007
I have a combo box on my userform. The selection made in the combobox will eventually control a calculation. I would like to generate some code so that when the user makes a selection in the combo box, and fills in all the requied info on the form, they can click a button on the userform which will generate a new combobox on the worksheet which would contain the user selection, along with the array that populates the combobox on the userform.
View 3 Replies
View Related
Dec 8, 2009
I am trying to return a TRUE or FALSE based on a date in a cell.
for example:
if cell A1 = 07/11/2009
I want A2 to show TRUE or FALSE if A1 is 14 days or more behind todays date.
I have tried stuff like:
=IF(A1=TODAY()-14,"True","False")
but it just always says false. EDIT: I have just noticed that if I change the date in A1 to exactly 14 days behind todays, it returns TRUE. So, it does work. Do I need to add a GREATER THAN in there?
View 6 Replies
View Related
Aug 10, 2014
I'm working on a spreadsheet that I need to return a value to "Unit Price" field in worksheet "Master Inventory" based on matching the "Product" field and the "Construction" field from the "Unit Pricing" worksheet.
In essence, I would like the "Unit Price" field to match the "Product" field from the "Master Inventory" sheet to the "New Product Description" field on the "Unit Pricing" sheet, then match the "Construction" field on the "Master Inventory" sheet to the column headers on the "Unit Pricing" sheet and return the value that corresponds to both criteria.
Ex: On the "Master Inventory" sheet, I would like the "Unit Price" field to match the "Product" (Book Browser) to the "New Product Description" (Book Browser) on the "Unit Pricing" sheet and then return the value where the "Construction" (Laminate) matches the column header (Laminate) on the "Unit Pricing" sheet which would return the value of "$240.00".
I've tried using a vlookup function, vlookup/match function, index/match function and an index/match/match function. I've attached a sample workbook.
View 3 Replies
View Related
Oct 14, 2008
I need help on using the If function. Basically I am trying to calculate the cost of shipments. For example, cost of sending 1 box is 150 (eg cell A3), 2 boxes is 280 (cell A4), 3 boxes is 400 (A5), 4 boxes is 500, etc upto to 10 boxes (cell A12).
What I am looking for is cell A1 to provide me the cost based on the manually entered value of cell A2, i.e. if I enter a number between 1 to 10 in cell A2, then A1 should return a number from A3 to A12, e.g. enter 3 in A2 then A1 should return 400.
Is there such a formula or do I have to enter manually the amounts into an If function?
View 11 Replies
View Related
Aug 3, 2014
What I am trying to do is have a drop down list in one cell and have the next cell bring in the correct price for the item in the first cell. Sounds fairly easy? Well both lists are 200 items.
I have been trying to do this with just three items so far. On sheet two, I have created two lists. The first list in column A contains dogs, cats, mice. The second list in column B contains 1, 2, 3. On sheet one, I have created the drop down list for the animals in the A12 cell. I would like for B12 to auto populate the corresponding number to the animal without having to create an if formula for each animal and number.
View 4 Replies
View Related
Feb 27, 2014
I have two columns in a spreadsheet that I want to use an IF function with. In the first column, I want a pick list containing 5 text options. Depending on which option is chosen, I want a number to auto-populate in the second column.
The numbers are important, because I want to repeat this pair of cells with slightly different text values in the second pair, and then to have a column that multiplies the two resulting numbers and conditional formats the result.
View 14 Replies
View Related
Aug 25, 2006
I would like to be able to use the Vlookup function to return more then one value as a result of the criteria. I have a cloumn of dates that populates the X axis of a gantt chart with data whilst the Y axis will be populated by a site reference resulting in a program of work, the Y axis data is the result of a vlookup function. My difficulty arises however with multiple sites, for instance where two or three sites will be visited on the same day. The vlookup function will only return the first value it finds in a range to the formulated cell. The result being a missing site(s) from the gantt chart / work program. is it possible to return all values to a cell i.e. site1, site2, site3. using a vlookup or do i need to use another method of doing this?
View 2 Replies
View Related
Nov 4, 2012
I don't have to keep using the ridiculous Substitute() work-around when I need to grab cell text after the nth instance of a character. In doing data cleanup I'm constantly having to grab text between, say, the 4th space character and the 6th one. Since Search() doesn't have an instance parameter, I end up having to use the 'Substitute trick', since it's the only string function that does have one.
See below for a typical example of the convoluted formula I need, and another example of it if Search only had 'instance' available. Simplifies the formula quite a bit.
*Typical real example, here to find the word between the 4th and 5th spaces in A1:
"=MID(A1, SEARCH("^", SUBSTITUTE(A1, " ", "^", 4)),
SEARCH("^", SUBSTITUTE(A1, " ", "^", 5))-SEARCH("^", SUBSTITUTE(A1, " ", "^", 4)))
Fantasy, 'fixed' example after MS adds instance:
=MID(a1, SEARCH(" ", a1, [instance #4]), SEARCH(" ", a1, [instance # 5])-SEARCH(" ", a1, [instance # 4]))
View 9 Replies
View Related
Feb 6, 2008
I currently have a drop down menu in one of my worksheets, in which I have several different text values entered. What I would like to do is link each of those text values to a numerical value, which would be entered in to another cell. So if I select "Option A" from my drop down list, and Option A is equal to 200, I want "200" to show up in another cell. If I select "Option B" from my drop down list, and Option B is equal to 400, I want "400 to show up in that same other cell.
View 4 Replies
View Related
Dec 7, 2013
I want to make a lesson table which distribute the names to lesson choice priority.
You can see detail and explanation at attached file. LessonChoice.xlsx‎
View 3 Replies
View Related
May 8, 2013
I have a worksheet that has 8 activex listboxes. Each listbox is tied to the sames list of values (identified as a named range). The named range is a list of countries. Each country should only be selected once, therefore, I would like the selected country(ies) to not show up as a choice when the user makes a selection from another listbox. If this is too hard, maybe we can get a msgbx to appear anytime the users tries to select a country that has already been selected.
View 3 Replies
View Related
Jul 11, 2013
I have two different modules in my automation - to be specific one module to convert file from LH to RH and another module to do the reverse - convert RH to LH.
I have put up a radio button choice for the user and based on which radio button is selected would like to run that particular module.
Below is my code. It always throws an error "expected variable or function not module"
VB:
Option Explicit
Public Sub MAIN()
If ThisWorkbook.Worksheets("FRONT").OptionButton1.Value = True Then
Call LH_to_RH
[Code]....
I am following the correct procedure to call modules. A few minutes of search said the modules have to be public sub routines
View 2 Replies
View Related
Aug 15, 2008
What I want to do is lets say in the drop down menu I have options Food, sports, Movies. now if I select Sports then it should give me a sub caterory options like baseball, hockey, football and not the options for food & movies as well - so as to make the choices lesser and more user friendly. How do I create that - is it too tough - I am a novice in excel. Can you upload an example sheet with tips on how you did it. I have uploaded an example.
View 3 Replies
View Related
Jul 25, 2006
I'm looking to set up a combo box with different year options and add functionality so the data that can be seen on the sheet at a given time is driven by the combo box year value. (functionality somewhat like a webpage, where once you choose a certain value from a drop down box, you see data corresponding to the value)
View 9 Replies
View Related
Jul 13, 2007
I'm using a ComboBox ,ComboBox2_Change(), to Call and run 1 of 4 different macros. It works fine if I choose a different item in the list each time, but if I choose the same one, it won't run the macro a second time.
View 5 Replies
View Related
Aug 22, 2007
I have a combo box that I have populated with choices (months of the year). I require users to select the month they wish to view their payslip with and then press "Go" (a command button) and jump to the worksheet that contains their payslip info. How do I get VBA (Excel 2007) to do this please? I have tried on the CommanButton1 code page to type
If combobox1.value = "May" Then Goto Worksheets("Sheet3")
This doesn't work and I know I'm doing something wrong as I remember when I was doing my project at school you had to give each combobox selection a value like 0, 1 or 2 but I cannot remember how to do that!
View 6 Replies
View Related
Apr 23, 2008
I have a drop-down box(K6) When a style is selected I need to have data show up in other drop-down boxes (H3,L3,P3) These selections would only pertain to the selection in K6. They would change when a different style is selected. There are multiple choices in the secondary drop-downs. [IMG][/IMG]
View 9 Replies
View Related
May 1, 2008
What I need to do is create a Drop Down box. When a user makes their selection it gives another drop down box from what they selected. Each choice in the 1st drop down will give a different drop down box in the next field from what they selected in the 1st. I am having troubles getting this to work.
View 3 Replies
View Related
Jun 22, 2008
1. I am starting with two independent tables, one with ‘ItemA’ and the other with ‘ItemB’
2. The user must be able to select an itemA which will point to itemB list, showing only a specific pre-defined group or combination of the itemBs.
3. This pre-defining of the itemB combination will be done uniquely for each itemA selection
Example: Selection of an itemA, row 2 will show, say, an itemB rows 2, 4, & 7 only. Selection of itemA, row 3 will show an itemB rows 4, 5, & 9 only. Selection of an itemA, row 4will show an itemB rows 2, 7, 11 & 13 only, etc.
4. In reverse, the user also needs to be able to select an itemB and display all itemA’s common to that itemB. Using the example above, the entry or selection of an itemB, row 2 will show rows 2 & 4, itemA.
This is represented visually in the attached GIF.
View 5 Replies
View Related
Dec 2, 2009
I have attached a spreadsheet that I need to automate. Cell C3 is a drop down box of the raw data found on the raw data sheet. I would like B6-8, c6-8 and d6-8 to automatically updated and change depending on what users select from the drop box in C3. (so basically im trying to re create the yellow table with formulae/ vb.)
View 4 Replies
View Related
Nov 14, 2006
I have 2 work sheet
First sheet is "Department "
11 Departments
Second sheet is "Designation "
20 Designation
i have generated VBA form
but..now in this form i want to create 2 input options..
1)select department (capture all depts. from Department sheet. if i select HR Department then in 2nd option all HR Designation should be copied
View 4 Replies
View Related
Nov 22, 2006
I have three textboxes (16,17,18) that need to be disabled if a certain value ("Regular Hours") is in combobox1. Would I use an If statement? Also, is there a way to "gray out" the textboxes to show they are disabled?
View 6 Replies
View Related
Nov 27, 2006
If I've Listbox1 in "ABC.xls" which contain selected headers of workbook "XYZ.xls".
How can I select entire columns in workbook"XYZ.xls" when press enter at Listbox ?
Do I've to put the code here ?
With Me.ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) Then
? ? ?
End If
Next i
End With
View 4 Replies
View Related
Aug 22, 2007
I have a way of getting a cell value from having a data validation linked to a row of cells containing lookup formulas.. which in turn are looing at a table.
I have attached a small example.
The problem is the spreadsheet is a large one and i was hoping I could shrink the size of this by removing the vlookup formulas by having some kind of index/match/lookup formula inserted directly in the data validation.
I got this to work using nested IF formulas but its not very practicable!
The attached example has data validation in column A that selects the task type. Choosing this then changes the values in the vlookup area.. which then becomes the validation list for cell in column B.
View 9 Replies
View Related