View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Offsetting to identify value in header row

It is a little hard to figure out exactly what you were trying to do based
on the code you posted as that code seems to be iterating *down* a column
while your message appears to be asking for a changing *column* value. So,
without more information about what you really want to do, I can't suggest
actual code, but see if this code sample helps you. Put some values in F1
through M1 and some other values in F4 through M4. Then this code...

For Each R In Range("F4:M4")
Debug.Print R.Value, Cells(1, R.Column).Value
Next

will iterate *across* Row 4 from cell F4 to M4 and prints to the Immediate
window the contents of what is in each cell of F4:M4 along with the contents
of Row 1 for that cell's same column. Does that help you any?

--
Rick (MVP - Excel)


"MJKelly" wrote in message
...

Rick,
True the header row will always be row 1.

I'm still not sure how to write the code to reflect this however?

Matt