Improving a macro

Major.Bull Posts 1 Registration date Tuesday January 19, 2016 Status Member Last seen January 19, 2016 - Jan 19, 2016 at 05:04 PM

If someone out there can help me with a macro, I would greatly appreciate it and you will be in my debt until the cows come home.

The macro was written as my first attempt at writing and its not very sophisticated. The macro returns the next number up a column from a number selected by me and colored yellow so I can filter all those numbers.

The problem is that the macro just goes up one cell. If there is no number in that cell, the macro returns a blank. I would like the macro to go up to the next number and return a real number and not a blank.

I have copied the macro and included it in this message. Please help me if you can. Thanks ever so much.

Sub Colour()

Dim i As Integer
Dim j As Integer
Dim k As Integer

Dim q(2) As String
Dim y As Integer
Dim z As Integer

q(0) = "Powerball"
q(1) = "Lotto Texas"
q(2) = "MegaMillions"

For z = 0 To 2

y = Sheets(q(z)).Index


For j = 0 To 5

i = 7
k = 6 'test

Do Until Cells(i, j + 2) = "stop"

If Cells(i, j + 2).Interior.Color = RGB(255, 255, 0) Then

Cells(k, 10 + j) = Cells(i - 1, j + 2)
k = k + 1

End If

i = i + 1


Next j

Next z

End Sub

Thanks again to all.