Thread: Move values
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Geir[_2_] Geir[_2_] is offline
external usenet poster
 
Posts: 7
Default Move values

What can be wrong?

Sub copy()
Dim rng As Range, cell As Range
Dim rw As Long
Dim cLastRow As Long

On Error Resume Next
Set rng = Range("G3:G4510").SpecialCells(xlFormulas, xlErrors)
On Error GoTo 0
rw = 0
If Not rng Is Nothing Then
For Each cell In rng
If cell.Text = "#N/A" Then
rw = rw + 1
End If


Sheets("Sheet1").Select
cLastRow = Cells(Rows.Count, "C").End(xlUp).Row
Range("C" & cLastRow).Offset(1, 0).Select


Sheets("Sheet1").Cells(rw, "C").Value =
Sheets("Sheet2").Cells(cell.Row, "A").Value


Next
End If
End Sub