![]() |
Excel VBA - Skipping #VALUE! error
I am using the following macro in a worksheet (this is a partia
macro): j = 1 invSheet.Activate Range("A1").Select For i = 0 To ActiveSheet.UsedRange.Rows.Count If ActiveCell.Offset(i, 3).Value < 0 Then newSheet.Range("A" & j).Value = ActiveCell.Offset(i, 0).Value j = j + 1 End If Next i End Sub There is only one problem with the macro. If it runs into any valu that is not a number such as #VALUE! or #N/A, the macro stops. M assumption is that I could use ISERROR somewhere in this macro t ignore any error that can occur. How can I implement it into the macr properly? Thanks -- Message posted from http://www.ExcelForum.com |
Excel VBA - Skipping #VALUE! error
Try putting "On Error Resume Next" at the beginning of
your macro. regards, Hans -----Original Message----- I am using the following macro in a worksheet (this is a partial macro): j = 1 invSheet.Activate Range("A1").Select For i = 0 To ActiveSheet.UsedRange.Rows.Count If ActiveCell.Offset(i, 3).Value < 0 Then newSheet.Range("A" & j).Value = ActiveCell.Offset(i, 0).Value j = j + 1 End If Next i End Sub There is only one problem with the macro. If it runs into any value that is not a number such as #VALUE! or #N/A, the macro stops. My assumption is that I could use ISERROR somewhere in this macro to ignore any error that can occur. How can I implement it into the macro properly? Thanks! --- Message posted from http://www.ExcelForum.com/ . |
Excel VBA - Skipping #VALUE! error
Thanks for the suggestion.
I attempted to use the "On Error Resume Next" in the beginning of m macro and also tried placing it in several other places within m macro. The only thing it seemed to do was actually include the valu that I did not want. Do you have another idea? Thanks -- Message posted from http://www.ExcelForum.com |
All times are GMT +1. The time now is 06:25 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com