Combobox with search suggestions on mobile device - excel

I created a combobox of which the list of options updates whenever you type in the box. Just a bit like entering a search in google works with suggestions.
I followed this tutorial to do so: https://trumpexcel.com/excel-drop-down-list-with-search-suggestions/
There are 4 columns of data in the sheet that make this work, combined with a named range, and a short piece of VBA to update the combobox. The combobox is in linked to cell B3. And data is in E:H starting at row 3.
First column includes the options for the combobox. There are 5619 possible options to choose from.
Second column has the following formula to determine if the entry of the combobox is in the text of the same row in the first column: =--ISNUMBER(IFERROR(SEARCH($B$3,E3,1),""))
Third column has the following formula to establish the amount of matches found: =IF(F3=1,COUNTIF($F$3:F3,1),"")
Fourth column has the following formula to return the list of possible options based on the value typed in the combobox: =IFERROR(INDEX($E$3:$E$22,MATCH(ROWS($G$3:G3),$G$3:$G$22,0)),"")
The code to update the combobox is as follows:
Private Sub ComboBox1_Change()
ComboBox1.ListFillRange = "DropDownList"
Me.ComboBox1.DropDown
End Sub
With DropDownList Being a named range that selects all the names in the fourth column.
Now that I have this working on my desktop I want this to also work on mobile devices (tablets or smartphones). On my personal device, using the Microsoft Excel app, it is not supported (This version of excel doesn't support ActiveX-control elements). Is there a way to achieve the same result that would work on mobile devices?

Related

Getting Values from Multiple Comboxes in same sub

I have an excel sheet workbook with 2 sheets. One sheet has data imported from an external source and the other sheet then filters this data. I want to be able to select a date range to narrow done the filtered results.
To do this, I have 4 comboboxes, one checkbox, and one button. When the button is clicked I want my sub to first see if the checkbox has been checked. If it has not, then just run filter the data regardless of date. If the checkbox is checked, I then want to look at the four comboboxes. The first two will have the start year and start month and the last two will have the end year and end month. I want to take these values and filter my data using this criteria as well when the checkbox has been checked.
The issue I am having is that I cannot get the value of the combobox. For example, I named one of my comboboxes "Start_Month". In my sub, when I select the sheet with the combobox first, then I use "Start_Month.Value" to check the combobox value, but this gives me runtime error 424 "Object Required".
Does anybody know how to get the value of four different comboboxes in the same sub or is this not possible?

Excel ComboBox Crashing with down arrow keystroke

I have created a ComboBox to do a Google-style search of Cities. I have my ComboBox on sheet 1, that is linked to a dynamic range of cities on sheet 2. The ComboBox output cell is what changes the dynamic range.
Here’s the problem I’m having. I start typing “sea” and I get two results in my drop down list-seaport and Seattle. So far so good. Then I use the down arrow to Select Seattle and the program crashes and restarts. I believe it is because when I hit down one time, seaport is selected and this narrows down my range to just the one option and Seattle disappears.
Is there any way around this? Either disabling the use of the keyboard down arrows for selections or preventing the output to the linked cell until a selection is finalized?
This the code for my combobox on Sheet1
Private Sub TempCombo_Change()
TempCombo.ListFillRange = "Cities"
Me.TempCombo.DropDown
End Sub
The named range "Cities" is defined by formula on sheet 2
='City Data'!$L$2:INDEX('City Data'!$L$2:$L$570,MAX('City Data'!$K$2:$K565,1))

Macro button to copy link in pivot table based on Slicer

I'm starting with a Pivot Table that has all my data. One of the data fields is a URL string that I ultimately want to send my users to.
To make searching through the pivot table as easy as possible, I've got a couple slicer windows to let the users click their search criteria. What I'd like to do, is based upon their search criteria (once narrowed down to one result), is have a Macro Button that automatically launches their browser (lets say internet explorer) with the link found in the pivot table.
I can figure out the launching of the browser (or just a copy text), but is there a way that I can program the Macro Button's action based upon the selections of the Slicers that are associated with my pivot table?
Any help would be much appreciated!
If I understood you correctly, you want to launch your code when only one link appears in PivotTable (after you apply slicers to it).
You can achieve this with Worksheet_PivotTableChangeSync event and helper cell.
lets assume you have your pivot table in column G, starting from cell G2. Enter this this formula =COUNTA(G3:G20) in cell G1(adjust range to your needs).
then in your worksheet module (not regular module) enter this code.
Private Sub Worksheet_PivotTableChangeSync(ByVal Target As PivotTable)
Dim a As Long
a = Range("G1").Value
If a = 1 Then
'your code for link in cell G3
Else
End If
End Sub
Now when you slice your PivotTable to only one selection, COUNTA formula will evaluate to 1 and trigger Worksheet_PivotTableChangeSync event.

Can't use more than one combo box on excel

I have made two active X combo boxes for a list of 220 sites. Before making the active x combo box i have made a sheet that searches through my data and finds the sites that match with what i am typing as i go.
I then used the name manage, refering to the formula in the first cell of the list
=Sheet1!$G$2:INDEX(Sheet1!$G$2:$G$220,COUNTIF(Sheet1!$G$2:$G$220,"?*"))
I have then writen this in the ListFillRange in the properties of my combo box.
It works fine for one, but once i had made the second one and selected the site the first one will no longer let me search through.
I have used the same formulas on both but they originate from different sheets to see if this fixed the problem however that was unsuccessful. (the boxes are on different sheets) When i click on the next sheet after using the box on the first sheet, it still shows part of it as if it is crashing.
The boxes are independent so I'm not sure what to do next as i need to add another 3 on separate sheets.
I am also using this code for each box
Private Sub ComboBox1_Change()
ComboBox1.ListFillRange = "MList"
Me.ComboBox1.DropDown
End Sub
and similar for the other button but with a different range.
There is no need to use VBA for this, the Change Events specifically, if you just want to use and fill the combo boxes with Named Ranges.
The scenario I think you try to do is:
Create Named Ranges that will be the source of your combobox:
Fill the range with your data, select the range, Right Click, Select Define Name and give the range a name. MList in your case I believe.
Create Combobox:
Goto Developer Tab, Insert in your case ActiveX ComboBox, Draw it on your sheet, right click the ComboBox, select properties, find ListFillRange in properties and enter the name of the Named Range you created in step one
Repeat for Combobox 2, with the same or a different Named Range depending on what you try to do
Leave Design Mode
Boths Comboboxes can now be used to type in what you are looking for.
If this is not what you tried to do, please try edit your question and in detail try to explain what you try to do and what you like to accomplish by doing so.

Dynamically Populate Listbox - Exclude Empty cells

I am creating a form in excel (not a userform) and I am populating the listbox using cells. However, these cells are sometimes A1:10 and sometimes they are A1:A4. Is there a way to dynamically change what is shown in the listbox?
Right now, when I use A1:10 and there are only 4 cells populated, I get the list of 4 populated cells followed by 6 blank entries. I'd like to get rid of the 6 blanks when there are only 4.
Unfortunately, this is more of a workaround than a solution. However, it may be able to do what you need it to do. I've been hitting the same wall you are with trying to make ranges dynamic.
Without seeing some code to know exactly what you're doing, try something like this.
Private Sub ListBox1()
x = 1
'Add items to listbox until you reach an empty cell.
Do while Cells(x,1) <> ""
ListBox1.AddItem Cells(x,1)
Loop
I'm not very familiar with listboxes outside of userforms but this should do approximately what you want to do.
Edit your original post with your code so we can try and get a better understanding of what you've tried and what you're trying to do.
You can create a named range using a dynamic formula. Either of the below formulas will work.
=A1:INDEX($A$1:$A$10,MATCH("",$A$1:$A$10,0)-1)
=OFFSET($J$7,0,0,MATCH("",$J$7:$J$32,0)-1)
To create the named range, click ctrl+F3 then click new, insert one of the two options above into the "refers to:" section, then label the new range whatever you would like. in the "row source" section of the listbox simply type in the name you selected for your new named range.

Resources