Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Finding a used / filled rows

How can I write a sub-routine that will look for a row that is used /
filled. I.E. rows C1 to C8 are empty and it keep skipping the empty rows
until it finds a row that is used / filled. In this case row C9 is used.



*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Finding a used / filled rows

Hi

Try this:

Sub FindUsedRow()
TargetCol = "C"
If Range(TargetCol & "1").Value = "" Then
UsedRow = Range(TargetCol & "1").End(xlDown).Row
Else
UsedRow = 1
End If
Debug.Print UsedRow
End Sub

Regards,
Per

"ogopogo5" skrev i meddelelsen
...
How can I write a sub-routine that will look for a row that is used /
filled. I.E. rows C1 to C8 are empty and it keep skipping the empty rows
until it finds a row that is used / filled. In this case row C9 is used.



*** Sent via Developersdex http://www.developersdex.com ***


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Finding a used / filled rows

Hi Par
Thank you for taking your time in helping out. I copied and paste your
FindUsedRow, however it doesn't work. I've left rows C1 to C8 empty. Is
there someting else I should be doing?



*** Sent via Developersdex http://www.developersdex.com ***
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Finding a used / filled rows

You need to look in the Immediate window to see the 9

Or add a message box

Sub FindUsedRow()
TargetCol = "C"
If Range(TargetCol & "1").Value = "" Then
UsedRow = Range(TargetCol & "1").End(xlDown).Row
Else
UsedRow = 1
End If
MsgBox UsedRow
Debug.Print UsedRow
End Sub


Gord Dibben MS Excel MVP

On Thu, 09 Oct 2008 13:05:02 -0700, ogopogo5 wrote:

Hi Par
Thank you for taking your time in helping out. I copied and paste your
FindUsedRow, however it doesn't work. I've left rows C1 to C8 empty. Is
there someting else I should be doing?



*** Sent via Developersdex http://www.developersdex.com ***


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Finding a used / filled rows

Thank you Gord. It works.
However, I'm sorry I should of indicated at the and of my request; Once
it has found the used / filled row, it will select that cell.

Ogopogo5

*** Sent via Developersdex http://www.developersdex.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
Hpw do I delete multiple empty rows found between filled rows? Bill Excel Worksheet Functions 2 November 15th 09 07:12 PM
Print data filled rows only Cricket Excel Worksheet Functions 2 June 22nd 08 05:54 AM
Exporting Only Filled Rows To Another Workbook Cuneyt Excel Programming 12 March 21st 06 07:48 PM
finding the no. of rows in a COL filled with numbers, zeros and bl z.entropic Excel Worksheet Functions 14 May 21st 05 11:05 PM
Deleting rows filled with 0 Perry Kew Excel Programming 2 December 8th 03 06:16 PM


All times are GMT +1. The time now is 12:11 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"