![]() |
Inspecting cells in a row in a named range
Works great. (For anyone else using this, there is a trivial spelling error:
"Colummns." vice "Columns") thanks "Leith Ross" wrote in message ... Hello Jim, This examines the first and last rows of data. Code: -------------------- Dim FirstRow As Long Dim LastRow As Long Dim FirstColumn As Long Dim LastColumn As Long Dim DataCell As Range Dim FieldName As Name For Each FieldName In ThisWorkBook.Names If Not FieldName Is Nothing Then Set DataCell = Range(FieldName) With DataCell FirstRow = .Row LastRow = .Rows.Count - FirstRow + 1 FirstColumn = .Column LastColumn = .Colummns.Count - FirstColumn + 1 End With 'Examine First Row of Data For C = FirstColumn To LastColumn Debug.Print "cell: ", DataCell.Cells(FirstRow, C).Value Next C 'Examine Last Row of Data For C = FirstColumn To LastColumn Debug.Print "cell: ", DataCell.Cells(LastRow, C).Value Next C Endif Next FieldName -------------------- Sincerely, Leith Ross -- Leith Ross ------------------------------------------------------------------------ Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465 View this thread: http://www.excelforum.com/showthread...hreadid=484994 |
All times are GMT +1. The time now is 06:50 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com