Offsetting to identify value in header row
I am not entirely sure what range you intended this line to cover...
For Each c In Range(r.Address).Offset(0, 4).Range(r.Address).Offset(0, 147)
Seems to be too many dotted values to me. Are you looking to cover columns H
through EU by any chance? If so, try this statement in place of the one
above and see if that does what you want...
For Each c In Range(R.Offset(0, 4), R.Offset(0, 147)).Address
--
Rick (MVP - Excel)
"MJKelly" wrote in message
...
Rick,
Thanks for the help.
The following line works when I only query one row. As soon as I
attempt to loop through multiple rows nothing happens.
r.Value = Cells(3, c.Column).Value
I have a table headed with ten minute time windows. I want each row
to be checked so the time of the first task (first nonblank
timewindow) is input to column B of the same row. Ithink the error
lies in the third row of code below? How do I loop through a range
which is based on an offset of the current cell?
ThisWorkbook.Sheets("Monday").Select
For Each r In Range("D4:D10")
For Each c In Range(r.Address).Offset(0,
4).Range(r.Address).Offset(0, 147)
If Not c.Value = "" Then
r.Value = Cells(3, c.Column).Value
Exit For
Else
End If
Next c
Next r
Hope this makes it clerarer?
Matt
|