We investigate the dividend optimization problem for a company whose surplus process is modeled by a regime-switching compound Poisson model with credit and debit interest. The surplus process is controlled by subtracting the cumulative dividends. The performance of a dividend distribution strategy which determines the timing and amount of dividend payments, is measured by the expectation of the total discounted dividends until ruin. The objective is to identify an optimal dividend strategy which attains the maximum performance. We show that a regime-switching band strategy is optimal.