Automatically Run Macro From Validation List
Aug 4, 2006
I want to do now is link the code below to a drop-down menu I have created on one of the sheets in the workbook. I created this list using data validation and declared this drop-down menu as MIndex and the values to choice from are 0,1,2.
Does anyone know how I can link this drop-down menu to the macro. So basically once the drop-down menu is activated run this macro.
Sub SumMonthlyVol()
Dim wSheet As Worksheet
For Each wSheet In Worksheets
Select Case UCase(Left(wSheet. Name, 2))
Case "AJ", "CJ", "PJ"
If (MIndex = 0) Then
wSheet.Range("L52") = "= SUM(R33C4:R50C12)"
Else
If (MIndex = 1) Then
wSheet.Range("L52") = "=SUM(R34C4:R50C12)" ......................
View 9 Replies
ADVERTISEMENT
Jun 20, 2008
I can't seem to find a way to make a data validation list automatically show the first item in the list rather than showing blank.
View 10 Replies
View Related
Sep 24, 2007
I have created a validation list which automatically adds any new values a user enters.
Is there any way of sorting the validation list every time a new value is added to the list?
View 9 Replies
View Related
Jul 16, 2014
i have a validation list of about 100 items. Is it possible that on tabbing into the cell the validation list can automatically open and as I start to type, it will take me towards the right list item?
View 1 Replies
View Related
Jul 6, 2006
I've been using Dave Hawley's "Excel Data Validation List - Automatically Add to a Data Validation List" in my wb with great results, but now I am going to use a secondary wb to keep the Data Validation List and herein lies my problem. I lack the VBA skills to be able to modify the code and references so that when I input into the primary wb the data is updated in the secondary wb. The Primary wb is an xlt that I'm developing, each time a new xls is opened from the Primary.xlt, vba in the Primary.xls opens Secondary.xls. Secondary.xls has a named range "Names" which I wish to be able to update when data validation is performed in Primary.xls per the sample on this web site.
View 3 Replies
View Related
Apr 16, 2007
I'm trying to implement the feature from this great Ozgrid 'how to', and it's working for the most part, but the VBA falls over here...
Private Sub Worksheet_Change(ByVal Target As Range)
Dim lReply As Long
If Target.Cells.Count > 1 Then Exit Sub
If Target.Address = "$F$10" Then
If IsEmpty(Target) Then Exit Sub
If WorksheetFunction. CountIf(Range("Dept"), Target) = 0 Then
lReply = MsgBox("Add " & Target & " to list", vbYesNo + vbQuestion)
If lReply = vbYes Then
Range("Dept").Cells(Range("Dept").Rows.Count + 1, 1) = Target
End If
End If
End If
End Sub
Basically, I have a tab which contains 2 lists. One in Column A and one in Columb B. I want the corresponding dropdowns on a different sheet to allow entry of anything that's not on either of the lists.
I can get it to work if I place the lists on the same sheet as the main 'form', but I need to keep them on a seperate sheet (and as the 'how to' suggests the lists can be on any sheet, I thought it'd work 'out of the box').
View 9 Replies
View Related
Mar 5, 2008
trying to incorporate this in to a workbook in which name range is on a separate sheet to where the validation cell is but with no success could any one tell me how to adjust it so that it works,
View 8 Replies
View Related
Mar 5, 2008
I've been trying to create a form that contains a list with an auto-complete option.
[url]
I've tried it and it kinda works the way I'd like it to except:
1. Excel crashes if you press TAB or Enter after choose your selection.
2. You have to Double-Click on the Validation list tab to bring up the combo box.
If possible, it would be great if Excel didn't crash after pressing Enter or Tab
and if the combo box showed up immediately on selecting the validation list cell (or single click).
The VBA code is:
'==========================
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
Dim str As String
Dim cboTemp As OLEObject
Dim ws As Worksheet
Set ws = ActiveSheet
Cancel = True
Set cboTemp = ws.OLEObjects("TempCombo")
On Error Resume Next
With cboTemp
how to attach the file here but the website I mentioned contains a sample excel.
[url]
To summarise I'm hoping to create a sheet that:
1. Let's you click on the cell and then type something which causes it to autocomplete.
2. After I've made my selection I can press Enter/Tab/Click somewhere and it confirms it.
3. The rest of the sheet gets populated by results of lookup functions that are dependent on the selections.
View 3 Replies
View Related
Apr 15, 2011
On Sheet2, data validation is applied to cells D21:D70 to limit data to values to a list, which is a named range on another worksheet. There are ranges on two other worksheets with the same data validation rule. The range for the list is ‘Sheet1’!D12:D26 (which is named “Processes”).
On Sheet1, the user enters a list of their processes. Then on Sheet2 (and the other sheets where the data validation is applied), they select one of the processes from the list. This all works fine until they go back to Sheet1 and modify one of the previously entered values.
For example, "Brush Teeth" is entered as one of the processes on Sheet1. It is then selected on Sheet2. Then, the user goes back to Sheet1 and changes the value to "Brush Hair." When you return to Sheet2, the value is still "Brush Teeth." It can be manually be changed by selecting “Brush Hair” from the drop-down list (“Brush Teeth” is no longer available), but it doesn’t automatically update.
Data validation was applied to a single cell (A3) and the list was on the same worksheet (B1:B3).
Option Explicit
Private oldValue As String
Private Const DVCell As String = "A1"
Private Const dataList As String = "B1:B10"
[Code]...
'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in.
On Sheet2 (I assume I need to add this code to every applicable sheet), I tried editing the first part of the code as follows (changes in bold), but when I click on any cell on Sheet2 that has the data validation rule applied, VB returns the error “Run-time error ‘1004’: Method ‘Range” of object ‘_Worksheet’ failed.” If I go into the debugger, the second instance of “If Not Intersect(Target, Range(dataList)) Is Nothing Then” is highlighted.
[Code] .....
View 9 Replies
View Related
Apr 7, 2014
I'm trying to create a spreadsheet that has a data validation in it. I have a drop down list that has to options to select; Yes and no. Every time I create a new row to add more information I have to go through the process of creating a new data validation for for each cell in this coloumn.
Is there anyway of creating a way that every time I insert a new row, a data validation list box will appear in the coloumn that I want it in?
Sample Workbook: datavalhelp.xls
View 3 Replies
View Related
Oct 12, 2011
I have a dropdown list in C24:C50 (=CategoryList) with data validation and a sub list in D24:D50 (=ItemList) with data validation. I am looking for a way to have code automatically run after selecting an item in the data validation dropdown list in column C.
Example; I click on C24 and make a selection. I what it to trigger code that would move me to D24 and open up the data validation list in D24. After the selection in D24 I would like it to move me back and down 1 row to C25. I have not found anything directly related to this but I have found that code can be run after a selection in a valadition list.
View 2 Replies
View Related
Oct 27, 2009
I am trying to learn the concepts, then apply them to a set of actual worksheets. I am trying to use named ranges from one worksheet in another worksheet. The named ranges need to expand. Although I can get the add data to a dummy worksheet to work within the same worksheet and I can even get a named range to work in the foreign sheet.
My problem is, when I can end up adding the additional data to the named range, it will only add one name. I have a number of named ranges that are referenced on various worksheets. The idea is, certain named ranges should be able to expand so I donft have to type them all in. (There could be hundreds of manufacturers or models.) I would also like them to be able to sort themselves after additional names are added to the named ranges. I would also like them to auto populate as well. I am using Excel 2003 SP3 (11.8307.8221). I have enclosed the file. Drop down lists (named ranges) are on the worksheet called DROP DOWN LISTS (LOCKED) **ITfS NOT CURRENTLY LOCKED**.
The data validation issues are on the worksheet called Rev7.0 Wood (Basic Sheet.) There are other instances to use these, but I hope to learn to do them myself on the other worksheets. Of particular interest is Column f.................
View 3 Replies
View Related
Jul 30, 2008
I have a workbook that contains a worksheet with commission data with a validation list of about 50 items. Each of these items represents a sales peron within my organization. Every month I select each of these items or sales people from the validation list (using the drop down box), which changes the commission data for each rep on the tab, then convert this to pdf to create and send each of these reps a commission statement.
View 9 Replies
View Related
Mar 24, 2008
I have seen this problem mentioned on other threads, but, didn't see the resolution. I got the below code from contextures.com's sample spreadsheet DataValComboBoxSheet.xls. When I press the tab or enter key, Excel crashes. This macro does exactly what I need which is to allow the user to autocomplete from a long list of validation values that come from another spreadsheet. The code causing the crash is the Select Case KeyCode statement when the keycode is 9 or 13. I am running Excel 2002.
Option Explicit
Private Sub TempCombo_KeyDown(ByVal _
KeyCode As MSForms.ReturnInteger, _
ByVal Shift As Integer)
'Hide combo box and move to next cell on Enter and Tab
Select Case KeyCode
Case 9
ActiveCell.Offset(0, 1).Activate
Case 13
ActiveCell.Offset(1, 0).Activate
Case Else
'do nothing
End Select ....................................
View 9 Replies
View Related
Aug 21, 2007
I have a normal data validation box on excel, but I want to be able to navigate my way through it using a macro. I can select & opent the drop down list with the following
SendKeys "%{DOWN}"
but then an action like
SendKeys "{UP}"
Does not navigate itself up the menu as a normal keystoke would. Any ideas on how to solve this? Basically, I want to select a cell, open the drop down menu, select the first choice in it (so thinking SendKeys "{HOME}{ENTER}" ) all using a macro.
View 9 Replies
View Related
Sep 3, 2007
I'm looking for a method, vba macro or Excel code, to preform the following task:
In the C column the user chooses one of several options from a menu, let's call these options 1 - 10 (this part is already done). Depending on the choise, different things are supposed to happen:
For 1-9, the formulas for cell A - Q on the current row should be copied to the next row (but with +1 in row number in formulas of course).
For 10, 3 blank rows should be created (well they already are blank..), on the forth row down, A3 - Q3 should be copied exactly. On the fifth row, the same formulas thing that was created for choise 1-9 should be created.
Since the real xls-file is too big already and it contains some sensitive information, I can't attach it here, but I made a small and similar xls-file, that better explain what I want to do.
View 8 Replies
View Related
Apr 8, 2007
I have a Data Validation list in cell A1 of a worksheet called LIST. I would like to modify the macro that I have recorded, the macro uses data from various worksheets. I would like to sort out some code so that at certain points in the macro it will select the worksheet that is shown in cell A1 of the LIST sheet and then carry out the code already recorded. THis will allow me to quickly change a sheet name that is refererred to in the macro numerous times without actually manually editing the sheet name in the macro code.
View 7 Replies
View Related
Dec 30, 2011
I have a data validation cell that has 5 items to be selected, lets say A-E.
I would like a macro that checks and does the following:
A or B selected, hide row 25-34, rows 45- 53
C or D selected, hide row 24-44
E selected, hide rows 34-53
In each case, the macro should check and unhide all rows between 25-53 before doing the above
View 9 Replies
View Related
Feb 28, 2012
I have a VBA macro for Excel 2007 below that loops through a workbook and deletes a picture (shape) in a range at the top of each worksheet.
The macro works fine until a cell which contains a seemingly unrelated data validation list on Sheets(1) is changed. The macro then repeatedly trips up with a 'Run-time error 1004 - Application defined or object defined error'.
The cell with the data validation is outside of the range in which the shapes are deleted and does not set any of the variables in the macro.
Sub DeleteLogos()
Dim Count As Integer
Dim NumberOfWorksheets As Integer
Dim Logo As Shape
Dim LogoZone As Range
NumberOfWorksheets = Worksheets.Count
For Count = 1 To NumberOfWorksheets
With Sheets(Count)
[code].....
View 4 Replies
View Related
Jan 31, 2014
I have the following macro that exports pdf's for every value in a validation list. Currently it's setup where I have included each value in the macro. This is fine with just a few values but I am about to add 900.
My question is, is there a way to write the macro so it exports a pdf for every value within a dropdown list until it hits a null value instead of what I have below so i don't have to repeat everything for every value in the list?
Here is what i currently have.
Sub Export_MarketSpecific()
'
' Export_MarketSpecific Macro
'
'
Sheets("Home Page").Select
Sheets("MOA-Page 1").Visible = True
Sheets("MOA-Page 1").Select
Sheets("MOA-Page 2").Visible = True
Sheets("MOA-Page 1").Select
Range("D2").Value = Range(Range("D2").Validation.Formula1)(2).Value
[Code] ..........
View 7 Replies
View Related
Aug 1, 2014
I have a spreadsheet where I am tracking several entries in a table that will keep growing. Three fields are Data Validation Drop Down Lists. The macro below works well to clear the two lists to the right when the first one is changed by the user.
[Code] .....
I want this to affect the rows below it in the table as they are added.
View 2 Replies
View Related
Jan 7, 2010
I'm trying to do a few things actually. I am somewhat a newb at programming, although I do understand how C++ and the coding works within Excel. To me, it's like the English language...knowing all of the vocabulary and formatting it right is important. If I don't know the vocabulary, I don't know what options I have.
This tool is being used in the call center I work in. It is to help eliminate repititious information used to notate accounts. I have attached a picture of what the tool looks like so you can have a better idea of what I'm working with. Here are a list of things I'm trying to do which I have searched and not found answers to:
1. I am trying to use a middle mouse scroll to scroll through validation list. This list information is located on a different locked tab. Basically, I have a few rows where a drop down selection can be made and it would be easier to scroll rather than manually moving the slider within the validation list.
2. As you can see, this "tool" an employee and I have created has many buttons. What I would like to do is to be able to click a button on the right and have it "stack" text within a single cell. In other words, if I click the button once, the text may be entered into the "actions taken" cell. If I click another button, I can have the option (or maybe a little "+" next to the button) to add this button's information to the end of the information already entered within the "actions taken" box. I've tried recording and using the keyboard and selecting "end" and then having the text added, but it didn't work. I've seen "loop" VBA code, but I don't want something to repeat, I want it to stack in the cell when clicked manually.
I'm sure there is a way to make the tool much better using VBA code and not use Excel, but I don't have an extensive knowledge of Excel to do something like that. I'm a very fast learner and understand how the coding works, so if you have an idea which may help, and you understand what I'm trying to do here, please provide your .02.
Basically, it's used so the Customer's name and phone number are entered manually, and then just about everything else is automated by the use of the buttons on the right. If I could get the 2 above options to work, it'd be perfect. I just figured out I could eliminate screen flicker and hide the macros working by using:
View 12 Replies
View Related
Feb 7, 2014
How do you automatically list all the worksheets within a workbook? I did some searching and decided to use the following code:
Sub ListWorksheets()
'Lists all the sheet names in the workbook onto the _
first sheet (starting at cell a4)
Dim i As Integer
For i = 1 To Worksheets.Count
Worksheets(1).Cells(i, 1) = Worksheets(i).Name
Next i
End Sub
It would be very useful if I could control the row in which the data is returned. "starting at cell [U]a4[U] seems to be that part of the command, but it still returns in the 1st row.
View 3 Replies
View Related
Mar 22, 2014
I am in need of a Macro that does the following:
In cell B4 I have data validation drop down list which refers to the range of values named Tarifalist. Tarifalist list has the following range of values: 01,1A-1F / DAC / 02 / OM / HM / 5A (Baja) / 5 (Baja) / 03
In cell B5 I have a data validation drop down list with =IF(OR($B$4="03",$B$4="OM",$B$4="HM"),Thirty,ThirtySixty) Where range Thirty has the value 30, and ThirtySixty has values 30 and 60
I would like in addition, a Macro which when either 03, HM, or OM is selected in cell B4, that it automatically sets the value to 30 in cell B5. The purpose is so that the input is foolproof, and no user can accidentally leave the value at 60. As of now, if the value has been left at 60, and 03, HM, or OM is selected in B4, B5 can stay at 60, which is not a valid input and must be manually changed.
View 2 Replies
View Related
Mar 5, 2008
if it is possible to write/record a macro that will automatically add a summary/total row immediately below the data that is created from an advanced filter. (XL00)
View 12 Replies
View Related
Jul 1, 2013
I have a list for example with two variants "YEs, "NO"..
Is there any possibility to choose YES or no in any cell an reflect the same value in another list on another sheet.
View 8 Replies
View Related
Sep 9, 2006
I'm not sure if its possible to do what I want. I'm trying to do it without VBA as my users might have a high macro security setting.
I have a validation dropdown in A2 where they pick 'yes' or 'no' for FLSA. I would like B2 to be a dropdown (validation, listbox, whatever) that would change based upon A2. If A2 is 'yes' I want to use the data in A5:B7 and if its 'no' use A10:B12. Ultimately I want B2 to equal one of the numbers from A5 - A7 or A10 - A12. However when they click on the drop down they see the combo of column A and columb B as column A has no meaning for the user.
View 9 Replies
View Related
Jun 15, 2007
I'm trying to use data validation to restrict the user to only selecting values in a list which I create. Right now, the list is a named range. I'd like to get rid of the range and just use a named list. I create a name using the following as my list.
Insert > Name > Create
Name: Fruit
Refers to:
banana,apple,orange
When I try to use the name Fruit in my data validation, I get the message "The List Source must be a delimited list, or a reference to single row or column." I thought my name "fruit" was a delimited list.
View 4 Replies
View Related
Jan 13, 2009
I am trying to create a fairly simple spreadsheet with about 8 columns and about 400 rows. One of the columns features a drop-down list with about 8 or 9 different options. Dependant on which option is selected, i would like the entire row to change colour with that option.
For example:
FAILED - whole row changes red
SUCCESSFUL - row has no fill
Tested - row changes to orange
etc.
Is this possible within Excel 2003?
View 9 Replies
View Related
Oct 28, 2011
I'm looking for a way to get a unique list from a column to a data validation drop down list. Any fancy formula or vba script to create a UDF which. Does this?
View 5 Replies
View Related