View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default copy random rows

Hi Monica.

Try:

Sub Tester3()
Dim Rng As Range, rcell As Range
Dim srcRng As Range, destRng As Range
Dim srcSheet As Worksheet, destSheet As Worksheet

Set srcSheet = Worksheets("Sheet1") '<<===== CHANGE
Set destSheet = Worksheets("Sheet2") '<<===== CHANGE
Set destRng = destSheet.Range("A1") '<<===== CHANGE

On Error Resume Next
Set Rng = srcSheet.Cells. _
SpecialCells(xlFormulas, xlErrors)
On Error GoTo 0

For Each rcell In Rng
If rcell = CVErr(xlErrNA) Then
If Not srcRng Is Nothing Then
Set srcRng = Union(srcRng, rcell.EntireRow)
Else
Set srcRng = rcell
End If
End If
Next

If Not srcRng Is Nothing Then
srcRng.Copy destRng
End If
End Sub

Amend the worksheet names and the destination address to suit your needs.

---
Regards,
Norman



"monica" wrote in message
...
How can I copy all rows which has #N/A's on a sheet to
another. THe case is in a sheet i have to copy all those
rows (rowno 1, 3, 10, 33, 60,63,64...etc.) in random order
into another sheet?

how can i do this?

thanks a lot
monica