Here's my own back-of-the-envelope calculation:
1) To calculate the number of stars you can take the rough number of galaxies (170 billion or so) times the number of stars per galaxy (pretty much the same number) and end up therefore with a number that is as near as dammit to 1,000,000,000,000,000,000,000,000 (or 10^24). This is a lower bound as we've only considered the visible Universe, but took no real calculating at all.
2) To do the same thing for sand takes a bit longer, but looking up values for average mass of a grain of sand, and then the average size and density of beaches, and then using the following simple formula, doesn't take too long:
Number of sand grains on beaches = (Density of beaches) x (average Width of beaches) x (average depth of beaches) * (total length of world's coastline) / (mass of average sand grain)
reasonable figures for each of these can be looked up reasonably quickly, or guesstimated, eg:
- the world's coastlines are about 1.5 million km long (and aren't all beach, but let's pretend they are);
- the depth of beaches varies widely but it's probably reasonable to assume an average depth of somewhere around 10 metres or so;
-the density of beaches can be taken as somewhere between that of water (1000 kilograms per cubic metre) and that of sandstone (2000 kilograms per cubic metre) so let's call it 1500 kg/m^3;
- assume that all beaches are 100 metres wide;
- the mass of a grain of sand varies but is typically about 50 micrograms on average.
If you put these numbers in then you get something like 50,000,000,000,000,000,000,000, or 5*10^22 grains of sand on the earth's beaches. I have no idea how wrong this is but a comparison with the number of stars derived earlier shows that it is in fact smaller!
So there are (probably) more stars in the Universe than grains of sand on the Earth's beaches. If you include all sand from deserts, though, I think that the numbers would tip in favour of sand. But then if you included all stars in the invisible Universe, it might go back to stars again.
Bottom line, though, is that despite how tiny grains of sand can be, and how many of them must be on the Earth's beaches, the number of stars we can see is almost the same order of magnitude.