Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Array as a "named range" - formula ok in cells, but error as "named range" tskogstrom Excel Discussion (Misc queries) 11 December 28th 06 04:44 PM
inserting a named range into new cells based on a named cell Peter S. Excel Discussion (Misc queries) 1 June 4th 06 03:53 AM
Compare a selected Range with a Named range and select cells that do not exist PCLIVE Excel Programming 1 October 18th 05 07:09 PM
Populated Cells In A Named Range Bob Barnes[_3_] Excel Programming 3 May 6th 04 05:38 PM
Looping thru cells in a named range Michael Beckinsale Excel Programming 4 September 2nd 03 02:07 PM


All times are GMT +1. The time now is 12:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"