Help with data type in macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I have a column where default value is empty which gets updated as new
values are updated in other column.

I have a piece of code which compares the value of each cell in this column
to see if it is not 0 and then does some execution.

Here is a snippet:
read1 = 2
While Sheet6.Range("AA" + CStr(read1)).Value <> 0
read1 = read1 + 1
Wend

Now if I change the default values in this column to #N/A and change the
code to

read1 = 2
While Sheet6.Range("AA" + CStr(read1)).Value <> "#N/A"
read1 = read1 + 1
Wend
it is giving type mismatch error at line
While Sheet6.Range("AA" + CStr(read1)).Value <> "#N/A"

How do I fix this error?
TIA
Shilpi
 
change it to

While NOT IsError(Sheet6.Range("AA" + CStr(read1)).Value)

- Manges
 
Back
Top