ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy paste (https://www.excelbanter.com/excel-programming/324015-copy-paste.html)

Geir[_2_]

Copy paste
 
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


Tom Ogilvy

Copy paste
 
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

--
Regards,
Tom Ogilvy

"Geir" wrote in message
...
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





All times are GMT +1. The time now is 06:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com