Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default First and Last cells with data in a range

I am using a range consisting of part of a single column. How can I
find the first and last cells within the range that contain data?
These cells will not necessarily be the first and last cells in the
range though.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 136
Default First and Last cells with data in a range

{=SMALL(ROW(A1:A1000)*NOT(ISBLANK(A1:A1000)),COUNT BLANK(A1:A1000)+1)}
gives the row number of the first nonblank cell in range a1:a1000
{=MAX(ROW(A1:A1000)*NOT(ISBLANK(A1:A1000)))}
gives the row number of the last nonblank cell in range a1:a1000

Both formulas are array formulas and are entered with CTRL+SHIFT+ENTER.


wrote:

I am using a range consisting of part of a single column. How can I
find the first and last cells within the range that contain data?
These cells will not necessarily be the first and last cells in the
range though.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default First and Last cells with data in a range

To get the last row used in Column a

LastRow = Range("A" & Rows.Count).End(xlUp).Row


To get last row used in spreadsheet regardless of which column has th
entry

GetBottomRow = TheSheet.Cells.Find(what:="*", SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row



To get 1st row with data use
Note this will not work correctly if rows 1 and 1 are not blank

FirstRow = Range("A1").End(xlDown).Ro

--
Message posted from http://www.ExcelForum.com

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
Can't format cells in data range CLR Excel Discussion (Misc queries) 2 June 17th 09 02:31 PM
Copying a Range of Cells having data only shriil Excel Worksheet Functions 3 February 8th 09 09:36 PM
When entering data into a range of cells, select the entire range. Q Excel Discussion (Misc queries) 0 September 26th 07 04:36 AM
Put data in range of selected cells MusicMaker Excel Discussion (Misc queries) 3 September 6th 07 11:55 AM
Range of data among cells graph Excel Discussion (Misc queries) 4 July 16th 07 10:22 PM


All times are GMT +1. The time now is 01:15 PM.

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

About Us

"It's about Microsoft Excel"