LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default loop question

Needs a FindNext as well

Dim oCell As Range
Dim sAddress As String

With Cells
Set oCell = Nothing
Set oCell = .Find(What:="Report", _
After:=ActiveCell, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not oCell Is Nothing Then
sAddress = oCell.Address
Do
oCell.Offset(1, 0).Resize(5, 1).EntireRow.Delete Shift:=xlUp
Set oCell = .FindNext(oCell)
Loop While Not oCell Is Nothing And oCell.Address < sAddress
End If
End With

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"dabith " wrote in message
...
Hey Bob

I tried your code but it goes into a continous loop.

I played around with it to output a msg box to no avail. Any ideas???


Dim oCell As Range

Do
Set oCell = Nothing
Set oCell = Cells.Find(What:="1", _
After:=ActiveCell, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not oCell Is Nothing Then
'oCell.Offset(1, 0).Resize(5, 1).EntireRow.Delete Shift:=xlUp
freq = 1
freq = freq + 1
MsgBox "No. of freq: " & freq
End If
Loop Until oCell Is Nothing


Thanks


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



 
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
Loop question aelewis Excel Discussion (Misc queries) 2 October 24th 07 08:12 PM
Loop question N.F[_2_] Excel Discussion (Misc queries) 0 July 12th 07 08:02 PM
One more loop question Patti[_5_] Excel Programming 11 June 6th 04 07:14 AM
another loop question Patti[_5_] Excel Programming 5 May 31st 04 07:43 AM
For loop question luvgreen[_3_] Excel Programming 1 February 20th 04 03:30 PM


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