A vast generalization of Weierstraß's theorem is to Riemann surfaces.
Florack, inspired by methods due to Behnke-Stein, proved the following in 1948:
Let $X$ be a non-compact Riemann surface. Let $D$ be a closed discrete set in $X$ and to each $d\in D$ attach a complex number $a_d$.
Then there exists a holomorphic function $f\in \mathcal O(X)$ defined on all of $X$ such that $f(a_d)=c_d.$
One may think of $f$ as holomorphically interpolating some discrete data.
This result immediately implies that $X$ is a Stein manifold, a concept of fundamental importance in the theory of holomorphic manifolds: Stein manifolds are the analogues of affine varieties in algebraic geometry.
A complete proof is in Theorem 26.7 of Forster's awesome Lectures on Riemann Surfaces.
The special case where $X$ is an open subset of $\mathbb C$ is analyzed in John's answer.