You can still switch to a new retailer even if you have a credit balance with your old retailer.
When you switch away from your current retailer, your energy account balance needs to be brought to zero so the old account can be closed.
If you have a debit balance for energy you've used up to the switch date, you will need to pay this amount to your old retailer, using whatever is your usual payment method.
If you have a credit balance, your old retailer must refund you the credit amount. The details of how and when this payment is made would be subject to the detailed terms of your agreement with the old retailer. In general, these refunds are usually made to the account you used for bill payment, so if you had a direct debit or a credit card payment set up, the retailer will deposit the credit balance funds to your bank account to bring the energy account balance to zero, and it will then be closed.
If you manually paid your bills, your retailer should contact you to arrange payment of the credit balance.