Did you change your Dim statements to include As Integer for range0?

Dim range0 As Integer