Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
JPL JPL is offline
external usenet poster
 
Posts: 1
Default Finding 5 consecutive empty rows

Hi,

Does anyone have some code for a macros that will scan down rows t
find the first cell after 5 consecutive blank cells?

Many Thanks in Advance.

JP

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Finding 5 consecutive empty rows

Do the cells contain constants?

Dim rng as Range
Dim rng1 as Range
Dim cell as Range
On Error goto ErrHandler
set rng = Columns(1).specialCells(xlConstants)
On Error goto 0
for each cell in rng
if cell.Row 5 then
if application.CountA(cell.offset(-5,0).Resize(5,1)) = 0 then
set rng1 = cell
exit sub
end if
end if
Next
if not rng1 is nothing then
rng1.Select
End if
Exit Sub
ErrHandler:
msgbox "No cells with constants"
End Sub

--
Regards,
Tom Ogilvy


"JPL " wrote in message
...
Hi,

Does anyone have some code for a macros that will scan down rows to
find the first cell after 5 consecutive blank cells?

Many Thanks in Advance.

JPL


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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default Finding 5 consecutive empty rows

Hi JPL

Another option, assuming cells are empty and not
quasi blank (from formula):

Sub FindFirstNonEmpty()
'Leo Heuser, 28-5-2004
Dim Area As Range
Dim CheckRange As Range
Dim FirstNonEmptyCell As String
Dim NumberOfEmptyCells As Long

Set CheckRange = ActiveSheet.Columns("A")
NumberOfEmptyCells = 5

On Error Resume Next
Set CheckRange = CheckRange.SpecialCells(xlCellTypeBlanks)
On Error GoTo 0

For Each Area In CheckRange.Areas
If Area.Cells.Count = NumberOfEmptyCells Then
FirstNonEmptyCell = _
Area.Cells(NumberOfEmptyCells + 1, 1).Address
Exit For
End If
Next Area

If FirstNonEmptyCell < "" Then
MsgBox FirstNonEmptyCell
Else
MsgBox "None exist"
End If

End Sub


--
Best Regards
Leo Heuser

Followup to newsgroup only please.

"JPL " skrev i en meddelelse
...
Hi,

Does anyone have some code for a macros that will scan down rows to
find the first cell after 5 consecutive blank cells?

Many Thanks in Advance.

JPL


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





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Finding 5 consecutive empty rows

Thanks for these, very usefu

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default Finding 5 consecutive empty rows

You're welcome.


"JPL " skrev i en meddelelse
...
Thanks for these, very useful



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
Formula from consecutive rows to alternate rows? Neville Bailey[_2_] Excel Discussion (Misc queries) 2 March 25th 10 01:58 PM
Transposing data from consecutive rows into non-consecutive rows econ Excel Discussion (Misc queries) 0 March 10th 08 07:24 PM
finding empty rows and deleting Ryan Excel Programming 3 April 22nd 04 05:53 AM
Finding Empty Rows Tom Ogilvy Excel Programming 0 July 16th 03 04:54 PM
Finding Empty Rows Don Guillett[_4_] Excel Programming 0 July 16th 03 04:50 PM


All times are GMT +1. The time now is 09:36 AM.

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"