|
I don't know if this is beyond the scope of Excel, but I thought I'd at least ask before giving up. The software we are currently using for managing our inventory and known products is going to be replaced by a different one that lacks the same search capabilities (yay for parent company shenanigans). I've been trying to find a way to use Excel instead for searching, and it sort of works, but it's unsurprisingly much more fiddly than the current software we use. Below is an example of how it looks in Excel with only the bare minimum required fields: Apart from the first 3 columns plus the MRSP column, all of the columns contain a mix of text and numbers somewhere. While I can search by using the filter buttons on each column, this is as mentioned fiddly and I would like to emulate the current software by simply being able to type what I'm looking for in a cell in row 2 and have it search the whole column beneath it and filter out the results. Likewise clearing the contents of the cell should also clear the filtering. Because we don't always know the exact measurements of what we're looking for, we often do a range search between two values, which I can replicate by hitting the filter button and going into "Number Filters--> Between", but again, a lot of clicking for what is really quick and easy today; we simply type something like 80:85 in a cell to list everything from 80.00 to 85.00. In the text fields, we mostly use wildcard searches with * . I'm thinking that it should be possible, but I imagine it will require VBA which I don't know. I've been googling for the past week or so trying to find a ready made solution for this, but so far I've come up empty. Normally I'd resign myself to my fate, but our inventory list has some 65.000 entries which often requires a ton of fine-tuning searches across multiple columns to find what we're looking for, hence why I'm desperate for something faster and easier than Excels filter button fiddling. Is what I want even possible in Excel? AG3 fucked around with this message at 14:37 on Feb 15, 2022 |
# ¿ Feb 15, 2022 14:34 |
|
|
# ¿ May 11, 2024 12:14 |
|
Thanks a lot for the code! I couldn't quite get it to work, but at least I learned something trying to troubleshoot. Basically when I type something in a box, it'll pop up a runtime error 1004 "Autofilter method of range class failed", with the debug button highlighting this: code:
code:
The same error likewise pops up when I try to clear a search box, but with the debug marking that relevant part of the code. Googling seems to indicate that it's a common error, but I can't quite wrap my head around how a fix would work for this particular code. Time to call it a day and look at it again tomorrow when brain is less fried.
|
# ¿ Feb 16, 2022 15:29 |
|
After changing thiscode:
code:
I have the code pasted in the sheet directly instead of as a separate module since I couldn't get it to run at all when it was in a separate module, I don't suppose that's an issue?
|
# ¿ Feb 17, 2022 10:19 |
|
Holy crap, that actually fixed it! It doesn't seem to like "& last_cell" , but manually setting the range and dropping last_cell made the whole thing work! I guess the code needs to change as the list grows, but that's a tiny price to pay for a an actual practical filter function. One thing I noticed is that the wildcard "*" are reduntant since the filter in Excel seems to do that by default; i.e if I search for 1234 it'll still show a line containing ABC1234EDF whether the wildcard * is there or not. Is there a way to make it default to "begins with" when there are no wildcard * present? And for the numbers only fields (columns A to C) "equals" when there are no ":" present?
|
# ¿ Feb 17, 2022 13:40 |
|
DRINK ME posted:Yeah that’s all possible but it was just easier to knock it up than to try type out each change. The wildcard filtering doesn’t sound like it’s doing what it should from your description, so hopefully this works. This works more or less exactly how I had imagined. Thank you so very much, this is going to save me no small amount of headaches if my worst fears regarding the new software comes to pass! If I can buy you a couple of beers through paypal or something do let me know.
|
# ¿ Feb 18, 2022 11:51 |
|
So I've been fiddling with this for a bit and tweaked a few things (thanks to Google; I still can't code the stuff ) and there is one thing that has me stumped again. How on earth do you make sorting results not include row 2, the one you enter search criteria into? You'd think there would be an easy way to tell Excel "exclude this row from sorting" or "anchor this row in place and don't move it or its contents" but there doesn't really seem to be, except for row 1 which is the header. The problem of course is that as soon as you sort, the results start at row 2, which means that you can't use the search box again unless you delete the contents that just appeared (bad) or try to CTRL+Z, which works... sometimes at least. For now I'm resetting it by giving the search fields in row 2 a blue background, which I can sort by to get it to come back on top after I'm done with the actual search. If getting the sort function to leave row 2 alone is impossible then the only solution that comes to mind is to replace entering data in row 2 with ActiveX text fields for entering data instead or something. But that seems like a lot of work for something you'd think was straight forward to tell Excel to do (leave row 2 alone). But then again a lot of things aren't straight forward in Excel, so.
|
# ¿ Feb 21, 2022 15:42 |
|
I'm using a VBA code I googled to alter the enter key behavior for my sheet, to make it move right by default instead of down. The problem is, this code affects Excel permanently even in other files and persists through Excel restarts, until I manually run the code again to toggle it off. It looks like this:code:
|
# ¿ Oct 13, 2022 10:31 |
|
Harminoff posted:The easiest way would be to just put it in workbook activate/deactiviate Thank you, this works great! Several of the other solutions would've been fine for me personally, I didn't even mind the way it worked originally, but the worksheet I'm making is going to be used by people who can charitably be described as "not tech savvy". I need anything that can make this thing work by itself and not cause more tech support work for me.
|
# ¿ Oct 14, 2022 07:49 |
|
Is it possible to use vba to import a row from one sheet to another just by typing a specific number in a cell? For example: I want to be able to type the number 150 or a text string like ABCD in a cell in Column A, and have Excel search a specific column in a different sheet for that string and then copy the contents of the row containing that string to the current row I'm typing in. I've tried googling this and I can't seem to find anything like this, or any commands that seem like they can do exactly this.
|
# ¿ Jan 18, 2023 11:26 |
|
Harminoff posted:It's crazy how good it is, like just trying AG3's question gives working results. Hey, after reading this I tried it myself, and I guess I phrased it differently because it gave me this code: code:
|
# ¿ Feb 15, 2023 13:17 |
|
It does, thank you very much!
|
# ¿ Feb 17, 2023 14:39 |
|
I have a slightly modified piece of VBA code I got from google that I've been using for one of my Excel sheets at work, but for some reason I can't get it to work on the Excel version on my other PC. It goes like this:code:
The only appreciable difference between the two that I can think of is that I manually changed the list separator and decimal signs in my work PC's locale in order to make Excel CSV exports work with our web shop, because I couldn't get it to import CSV files that used semicolon as a list separator instead of comma, and I also changed the decimal sign from comma to period to match English. I did try doing the same on the other PC, but that didn't seem to make a difference in getting the code to work. AG3 fucked around with this message at 14:14 on Nov 14, 2023 |
# ¿ Nov 14, 2023 14:10 |
|
That's what's puzzling me. Everything is working perfectly on my primary work PC, but on my other work PC all of the code in the file except the background color changing works and I can't find any reason why that would be the case. No amount of stopping and restarting the code seems to make the color changing function come on either. FormatConditions seems like such a basic function too, so I can't think of a reason why only that would be blocked and not the other code. I'll have to test on a couple of other PCs at work and see if there's a setting on mine specifically that's making things strange.
|
# ¿ Nov 14, 2023 23:44 |
|
|
# ¿ May 11, 2024 12:14 |
|
Ninja.Bob posted:Given you mention changing locale settings, if your language is not English then you may need to change Holy poo poo, it was actually this. I had to change "TRUE" to "SANN" (Norwegian for true) and the code worked. Now the baffling thing here is that my work PC, where the code worked, IS set to Norwegian locale already, but the actual display language in Windows itself is set to English by default from the provider, while my other PC has a Norwegian display language. It's not the actual locale settings that made it stop working, it's the Windows display language. Thank you so very much, I would never have thought to try that.
|
# ¿ Nov 15, 2023 09:14 |