Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
if iserror then value = zero problem
Hi all,
I have the following vba code in Excel 2007 For j = 5 To Range("A5", Range("A5").End(xlDown)).Rows.Count + 4 If IsError(Application.VLookup(Range("A" & j), Range("RASUMMARY"), 2, False)) Then Range("F" & j).Value = 0 Else Range("F" & j).Value = Application.VLookup(Range("A" & j), Range("RASUMMARY"), 2, False) Next j The problem is, if the vlookup doesn't exist (iserror), then the value does not equal zero but shows up as #N/A. I've been beating my head on this one. Any help is appreciated. Thanks Kim |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
if iserror then value = zero problem
This worked for me.
Tim Sub Tester() Dim r, j For j = 1 To 3 r = Application.VLookup(Sheet1.Range("D" & j).Value, _ Sheet1.Range("A2:B6"), 2, False) Sheet1.Range("E" & j).Value = IIf(IsError(r), 0, r) Next j End Sub "Kim" wrote in message ... Hi all, I have the following vba code in Excel 2007 For j = 5 To Range("A5", Range("A5").End(xlDown)).Rows.Count + 4 If IsError(Application.VLookup(Range("A" & j), Range("RASUMMARY"), 2, False)) Then Range("F" & j).Value = 0 Else Range("F" & j).Value = Application.VLookup(Range("A" & j), Range("RASUMMARY"), 2, False) Next j The problem is, if the vlookup doesn't exist (iserror), then the value does not equal zero but shows up as #N/A. I've been beating my head on this one. Any help is appreciated. Thanks Kim |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
IF(ISERROR problem | Excel Discussion (Misc queries) | |||
iserror problem | Excel Discussion (Misc queries) | |||
IF ISERROR | Excel Discussion (Misc queries) | |||
ISERROR - #NAME? | Excel Worksheet Functions | |||
ISERROR | Excel Programming |