In this paper, the author used the variational iteration method (VIM) to find the analytical solution to homogeneous and inhomogeneous partial differential equations. Few numerical examples were presented to show the effectiveness and efficiency of the method. It was observed that by carefully chosen a very good choice of initial guess leads to a solution in a closed form. The method is elegant and reliable.