Copy paste

G

Geir

Hi All

I have a written macro that sort a range form A1:F510

But if #N/A is in the F column I want to copy the values in A column to
another cells. Can anyone help me with that.

Geir
 
T

Tom Ogilvy

Sub CopyData()
dim rng as range, cell as Range
Dim rw as Long

On Error Resume Next
set rng = Range("F1:F510").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
cells(rw,"G").Value = cells(cell.row,"A").Value
end if
Next
End if
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top