

To enable some cell editing, while leaving other cells locked, it's possible to unlock all the cells.

Lessīy default, protecting a worksheet locks all cells so none of them are editable. May the fleas of a thousand camels feast happily on the lower regions of your enemies.Excel for Microsoft 365 Excel 2021 Excel 2019 Excel 2016 Excel 2013 Excel 2010 Excel 2007 More. If Me.ListBox1.List(i, 1) = st1 Then 'checks each listbox1 entry against the variable, passed to it by 'each listbox2 entryĮxit Sub 'real trick is to remember to exit here or it will error out, filter() will still do it's thing, this throws off 'the references if you don't exit the f2 after removing the item 'calls it for each entry, see note included in that St1 = Me.ListBox2.List(i, 1) 'value of listbox2 column 1, which has the names I'm searchingį2 'call second function to compare the global variable to the listbox value Public st1 as string 'passes between the functionsįor i = 0 To Me.ListBox2.ListCount - 1 'listbox2 has the added values, I load this first, fill listbox1, 'then search 1 for the duplicates This has been solved a short while, back, but I found a slight alternative for those who just want to sort two listboxes for duplicates. Not perfect, but it prevents duplicate values and preserves index referencing Reset button clears both boxes, repopulates and autonumbers the first as seen above. ListBox1.RemoveItem (i) 'get rid of it from box1 ListBox2.Column(1, m - 1) = s2 'value of listbox1 column2 ListBox2.Column(0, m - 1) = s1 'value of listbox1 column1 M = ListBox2.ListCount 'subtract 1 from m to prevent errors (proper coding and all) S2 = ListBox1.Column(1, i) 'second column at index "i" S1 = ListBox1.Column(0, i) 'value of first column at selected index "i" I = ListBox1.ListIndex 'selected row in listbox1 ListBox1.Column(1, i - 2) = strBuildListBoxValues 'cell value being copied 'subtract 2 from i to make sure it starts at index 0 on the box, may be easier ways, this one works tho ListBox1.Column(0, i - 2) = CStr(m + 2) ' add 2 to m, because listbox index starts at 0 and StrBuildListBoxValues = wksSheetToLoad.Cells(i, 1).value 'loading box1 values from sheet, auto-number first column to reflect row indexįor i = 2 To 1000 'skip header row, aka # 1 on the sheet I just changed my reference for the index variable used in listbox2 I just added a column to listbox1, save the index value in the first column, the text name in the second, and copy that to my also two columned listbox2.

And may their arms be too short to scratch!įound an easy out. May the fleas of a thousand camels feast happily on the lower regions of your enemies. = True, and it says it's an invalid property reference among other error messages based on my typing. If they click item1, is there a way to lock or disable ONLY item1 where they can't click it again, and continue this when they add items 5, 6, and 9 (so those will be locked too)? I've been playing with various syntax for Listbox1.List(i).Locked My beta tester just showed me there's just enough room for error that the end users will likely blow it up without even knowing how or why (it changes the box1 reference when the itemsĪre removed, sometimes saves a duplicate row to the reference sheet, etc.) C# let me disable individual entries in the listbox controls, can I do that in this? To prevent duplicates I've been removing the added item from Listbox1, withĪ reset button that clears both boxes and repopulates the first. Working on a form control, Listbox1 populates from a worksheet column, and I use a button to copy selected items into Listbox2, saving the index from box1 as a cell reference.
