  Context. Abundance anomalies have been observed in field sdB stars and in
nearly all Horizontal Branch (HB) stars of globular clusters with Teff > 11
000K whatever be the cluster metallicity. Aims. The aim is to determine the
abundance variations to be expected in sdB stars and in HB stars of
metallicities Z \geq 0.0001 and what observed abundances teach us about
hydrodynamical processes competing with atomic diffusion. Methods. Complete
stellar evolution models, including the effects of atomic diffusion and
radiative acceleration, have been computed from the zero age main-sequence for
metallicities of Z0 = 0.0001, 0.001, 0.004 and 0.02. On the HB the masses were
selected to cover the Teff interval from 7000 to 37000K. Some 60 evolutionary
HB models were calculated. The calculations of surface abundance anomalies
during the horizontal branch depend on one parameter, the surface mixed mass.
Results. For sdB stars with Teff < 37000K and for HB stars with Teff > 11 000K
in all observed clusters, independent of metallicity, it was found that most
observed abundance anomalies (even up to ~ x 200) were compatible, within error
bars, with expected abundances. A mixed mass of ~1.E-7 M\odot was determined by
comparison with observations. Conclusions. Observations of globular cluster HB
stars with Teff > 11 000K and of sdB stars with Teff < 37 000K suggest that
most observed abundance anomalies can be explained by element separation driven
by radiative acceleration occuring at a mass fraction of ~1.E-7 M\odot. Mass
loss or turbulence appear to limit the separation between 1.E-7 M\odot and the
surface.
