Dropdown Functions Work in 2010 but not in 2007 - excel

Ok - here's what I have.
An Excel file that asks a User to fill out some fields.
The first sheet has some fields to fill out.
To assist the User, some fields are dropdowns. This is to ensure that the correct index values are used.
The User clicks on a cell (in this case N65) and that cell displays a dropdown.
The values displayed are from Col 1 of a range on a separate sheet.
The User selects a Col 1 value (the description in my case).
The corresponding row's Col 2 value (index value in my case) is saved to another cell on the sheet that has this bit of function code in it.
ta-da. das it.
Works great in 2010.
When a user opens the file using 2007, no dropdown appears.
Here is what goes into the destination cell, the cell that will ultimately end up holding the index value from Col 2. In this case the sheet is named Craft.
=IF(ISNA(VLOOKUP(N65,Craft!$A$2:$B$501,2,FALSE)),"",(VLOOKUP(N65,Craft!$A$2:$B$501,2,FALSE)))
Here is a variant of that same bit using named range instead.
=IF(ISNA(VLOOKUP(N65,Craft,2,FALSE)),"",(VLOOKUP(N65,Craft,2,FALSE)))
In either example, when using Excel 2010, the field, R69 for example, ends up populated with the Col 2 value after User selects a Col 1 value.
Basically wherever you stick that bit of function code, that field will get populated with whatever the VLOOKUP grabs from Col 2 for the row that contains User's Col 1 selection.
The Craft sheet just has two columns with 501 rows:
Select a Value
Craft Desc 1 | Craft_1
Craft Desc 2 | Craft_2
Etc...
Does anyone have an idea as to how I can get this working with Excel 2007 and 2010?
Thanks!

When a user opens the file using 2007, no dropdown appears.
In Excel 2007 we had to create a range-name in order to use DataValidation with a List from another sheet, entering =TheRangeName in the Source box. In Excel 2010 this is not essential and, when defining the source, we can just highlight a range in another sheet. I suspect that this may be the issue.
You will need to correct the Data Validation settings to use =TheRangeName, instead of =Sheet1!A1:A4. On the Home tab click the Find & Select button and choose Data Validation. This will select all the cells on the current sheet that have Data Validation. Alternatively, click in a cell that you know has Data Validation and choose Go To Special from the Find & Select list; from here you can select all cells that contain the Same validation as the current cell(s). If you can't find any such cells then you'll need to recreate the validation(s) from scratch.

I ended up using pnuts suggestion. =IFERROR(VLOOKUP(DropDown,Codes,2,FALSE),"") The way I got it to work was on the worksheet with the desc & code I selected the Desc column and named it and used that in the Data Validation because it seems to only work with a single column. Then I named the range for both Desc & code for use with the VLOOKUP function and that worked.

Related

Copy the values on the second column of a listbox to a worksheet Excel VBA

I have a userform created using Excel VBA that is used to register information before saving it to a worksheet. All the information the user enters is stored in a listbox and then copied to a worksheet. However, I need to copy each column of information to different ranges in the worksheet, they are not all together to copy whole listbox with the simple .List or .Value properties.
The listbox has four columns. Right now I am trying to get all the values stored on the second column to copy them to the worksheet. The number of rows in the listbox constantly changes depending on how many entries the user registers. I tried the following piece of code:
Range(FirstColumnRange).Resize(lstAllProducts.ListCount, 1).Value = lstAllProducts.List
This works perfectly for getting all the information on the first column of the listbox. Although the .List property gets all the values on the listbox, using the .Resize property with a fixed column value of 1 just saves the first column to the worksheet ignoring the others. The issue is that I can't seem to do the same for the other columns.
I tried the following code for getting the values of the second column:
Range(SecondColumnRange).Resize(lstAllProducts.ListCount, 1).Value = lstAllProducts.List(lstAllProducts.ListIndex, 1)
However, this only works if a row of the listbox is selected, and only saves that value. Is there a way to modify that last part of that code (lstAllProducts.List(lstAllProducts.ListIndex, 1)) so that I can get all the values on the relevant column (second column in this case) without selecting anything in the listbox? I would really appreciate any suggestion. Also, I would prefer a solution that does not require looping like the one I used for the first column.

Use common dropdown across multiple worksheets to change single cell

I have a large file with a Scenario Manager, where changing a single cell on the Summary worksheet changes the visible scenario throughout the rest of the workbook. Data Tables are working a treat providing the headline values for each option.
I'd like to have a drop down on each sheet that when changed will change the same single cell on the Summary worksheet, so I don't need to go back to the Summary sheet every time I want to switch visible scenarios.
This is a simple process if I'm using macros and would be the solution I'd normally jump straight to. But this needs to be done without macros and this is where I'm now struggling.
Does anyone know if this is possible (without macros) and point me in the right direction?
Josh
You can insert combo box (Developer Tab > Insert > Form Controls > Combo Box) on each sheet. Mention linked cell as a cell of the summary sheet (Absolute reference with sheet name). That cell will give you index of the item selected in the drop down list. Then you can insert index formula in the cell you want to change every time to get value of the drop down list. Once you insert it on one sheet you can copy it to other sheets. No macros required.

Getting data from other sheets with dropdown menu

I want to get the datas from other sheets to the main sheet by selecting the store name from the dropdown menu on main sheet.
So on main sheet, i want people to select the store name from dropdown list and retrieve the product stock datas (all sheets have same product names) and allow them to change the stock values and store them to corresponding store sheets that i will hide.
Here is an example sheet i prepared:
https://docs.google.com/spreadsheets/d/1BtrNKMSgurdft01P9Dw5MEh7rmYWPapwE18yhvDCdYE/edit?usp=sharing
Waiting for your help.
Thanks
You can probably achieve the first part with the INDIRECT function, which lets you convert a String into a Cell Reference or Named Range.
As an example, if you have Worksheets called Sheet1 and Other Sheet, and a dropdown with those names in cell $A$1 of another sheet, then you can retrieve the value from cell $B$2 of those sheets like so:
=INDIRECT("'" & $A$1 & "'!$B$2")
Which will evaluate to one of the following:
=INDIRECT("'Sheet1'!$B$2") > =Sheet1!$B$2
or
=INDIRECT("'Other Sheet!$B$2") > ='Other Sheet'!$B$2
This will not, however, let you send the data back to that sheet without delving into VBA. If you don't want to do that, you might be better off changing your drop-down to a series of Hyperlinks along the top of your worksheets to go directly to the sheets?

Excel CountA not correct when opening workbook

I have a .xlsm workbook used as a template (I am using Excel 2010) to create a workbook when users wish to download via a website.
A copy of the template is made when a download is attempted and values are written into a lookup tab in the copy (there are 2 columns: name and id) via .NET code. This part works great.
There is a second tab that uses a COUNTA formula to determine how many rows of data are populated in one of the columns.
My problem is that the COUNTA formula is showing a value of 0 instead of the correct value when the workbook is opened and macros have run. If I were to manually enter the field and refresh the value the value will be correct.
The formula is:
=COUNTA(LOOKUP!A2:A1000)
Why doesn't this work and what can be done to make it work?
Hello Here is a pretty fast way to count all of the Cells in A
Sub btnCount()
Range("A1", Range("A1").End(xlDown)).Select
MsgBox Selection.Count
End Sub

Data Validation in Excel through Cell

I want to set up Data Validation on a cell / row of cells so that the value in that particular cell cannot be changed but all the rest of the sheet can be edited, thus why I am not using read only.
Currently if I enter the value in the cell, go to Data > Data Validation > Custom & enter ""it achieves this (see screenshots http://imgur.com/a/Ggqar)
What I want to do is set this validation via the cell rather than manually as I plan on writing this field entry when create the excel document through my application.
I have done a lot on searching online and found methods for doing countif etc.. but nothing deal with formula entry for the Custom criteria.
Is anyone able to help?
Thanks for the quick reply DanB but it's not exactly what I am trying to achieve. My end goal is that my application can pass a value into the file (Column A Row 1 [If easier for formatting it can go into each row in column A which is populated but not required]) and the file will be saved locally. The user will then be entering details in Column B, C, D, E, etc... on their local machine, saving it and processing the file again. I want the application to check Row 1 Col A for the value and decide on how to process the remainder of the file based on this value (the reading the values in the file works already). Because each time my application generates a file it will be unique I want to try do the Data Validation using a formula in the cell so that I can write it using my application and not have to manually apply settings to the file. Is it possible to do this kind of validation using only formulas in the cell when populating it?
Fastest solution would be to use a Protected sheet, but only protect that Cell.
To do this, select the entire sheet, and choose Format Cells.
On the Protection tab, remove the check from Locked.
Now, select just the cell you want to protect, and lock it using the same method. At this point, your entire sheet, except for the 1 cell should have Locked unchecked.
Now, on the review tab within Excel, choose protect Sheet, and uncheck the option to "Select Locked Cells".
Then, while the sheet is protected(you can password protect that part of it), that cell can't even be selected, yet the entire rest of the sheet can be.

Resources