If you’ve left the ham out all day and it’s summer, you should probably freeze it, or use it immediately for soup. But if it’s only been out for a couple hours after cooking/carving, then you can keep it in the fridge for up to 5 days before using for soup.