I’m currently trying to create a program that will take an input from user that is a number eg. 58, 313, 490 and find the file with that number in it. To overcome it having multiple outputs, such as someone inputting 10 and it finds 10, 101, 102, 103, etc. I wanted to write a statement in Dir that would overcome this. The problem is that some files are titled as "### *.xlxs"
and some are "###_*.xlsx"
so I wanted to write a statement that would take both of these into account.
So far I have tried
filename = Dir(Uinput & (" " Or "_") & "*" & ".xlsx", vbDirectory)
I expected it to take either a space or a _ and work correctly
With this I get runtime error 13: type mismatch
Can I have an or statement within this or do I need another workaround? I’m very new to VBA and programming. Any help is appreciated, thanks.
1