Help with data type in macro

S

Shilps

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
 
M

mangesh_yadav

change it to

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

- Manges
 

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