Illy? My friend, the wonders that you have awaiting you when you branch out. So you want a grinder that can easily switch between coarse and espresso? Whats the ratio that you drink usually? Out of curiosity, what machine do you use? I ask, simply because you should be spending as much (or a bunch more) on your grinder than your machine. I use a modded older Gaggia Baby, which is a decent basic machine, but I run a Faema A6, a commercial grinder that costs roughly 3x as much. Of course my grinder is likely a tad overkill, but I know that it can handle whatever I throw at it, and that my grandkids will be able to use it.
You've got a few options, if you don't mind going used you can generally find commercial grinders that need a bit of TLC for fairly cheap on kijiji/craigslist (what I did, as I don't have $1500 for a grinder). If you're set on new, I would likely recommend the Le'Lit PL53. If I had to buy new under $300, I would run, not walk, to purchase one. However, it is stepless. This is a wonderful feature if you like really fine control, especially if you're a home roaster like me who adjusts grind to bean age. However, if you want to go grind some press-pot, it'll take 80 turns to get to that level, and there's no way to mark exactly where you were for espresso.
Now if you want to switch a lot, I would recommend the Baratza Vario. It's a compact little machine, and quite versatile, but it will run you 50% more than your budget. Worth it, but not if you're grinding Illy.
To be honest, the only grinder under around $400 that I would recommend you buy is the Le'Lit. But hey, if you're not a total nutjob you could probably buy a $200 Baratza Virtuoso and be quite happy with the results.