This is how to do what you want. You do not need to use an array, or store values somewhere to be able to process them. This code will start at the bottom of column C, and find the first non-zero value in each row - the number of columns can vary as well.
Sub Testing2()
Dim lngR As Long
Dim rngC As Range
For lngR = Cells(Rows.Count, "C").End(xlUp).Row To 8 Step -1
Set rngC = Cells(lngR, 3)
While rngC.Value = 0
Set rngC = rngC.Offset(0, 1)
Wend
Cells(lngR, 2).Value = Cells(6, rngC.Column).Value
Next lngR
End Sub
If it is possible that a row will not have a non-zero value in it, then you should make sure to include a way out:
Sub Testing3()
Dim lngR As Long
Dim rngC As Range
For lngR = Cells(Rows.Count, "C").End(xlUp).Row To 8 Step -1
Set rngC = Cells(lngR, 3)
While rngC.Value = 0
If rngC.Column = Activesheet.UsedRange.Columns.Count Then GoTo NotFound
Set rngC = rngC.Offset(0, 1)
Wend
Cells(lngR, 2).Value = Cells(6, rngC.Column).Value
NotFound:
Next lngR
End Sub
Bookmarks