View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default How do I use the font as a filter

Well, there were a couple of typos in the code, but after cleaning them up,
it ran fine for me:

Sub ABCD()
Dim rng As Range, cell As Range
With Worksheets("Sheet1")
Set rng = .Range(.Cells(1, 1), .Cells(Rows.Count, 1).End(xlUp))
End With
For Each cell In rng
If cell.Font.Size = 12 Then
cell.EntireRow.Copy Destination:= _
Worksheets("Sheet2").Cells(cell.Row, 1)
End If
Next
Set rng = Worksheets("Sheet1").Cells.Find("Target", _
LookIn:=xlValues, LookAt:=xlPart)
If Not rng Is Nothing Then
sAddr = rng.Address
Do
rng.EntireRow.Copy Destination:= _
Worksheets("Sheet2").Cells(rng.Row, 1)
Set rng = Cells.FindNext(rng)
Loop Until rng.Address = sAddr
End If
End Sub

--
Regards,
Tom Ogilvy


"Karlos" wrote in
message ...

Below is full script not mine, I hasten - still a little out of my depth
but willing to learn. The bottom half does not want to loop and stops
after one pass. What am I missing?

Dim rng as Range, cell as Range
With worksheets("Sheet1")
set rng = .Range(.cells(1,1),.cells(rows.count,1).End(xlup))
End With
for each cell in rng
if cell.Font.size = 12 then
cell.EntireRow.copy Destination:= _
worksheets("Sheet2").Cells(cell.row,1)
end if
Next
set rng = worksheets("Sheet1").cells.Find("Target" _
Lookin:=xlValues,LookAt:=xlPart)
if not rng is nothing then
sAddr = rng.Address
do
rng.Entirerow.copy Destination:= _
worksheets("Sheet2").Cells(rng.row,1)
set rng = cell.FindNext(rng)
Loop until rng.Address = sAddr
end if


--
Karlos
------------------------------------------------------------------------
Karlos's Profile:

http://www.excelforum.com/member.php...o&userid=28649
View this thread: http://www.excelforum.com/showthread...hreadid=483612