Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default worksheet error checking

How could I check from VB whether a spreadsheet has any
errors?

I'm trying to use
If xlbook.Worksheets(1).Cells(i, j) = "#DIV/0!" Then ...
but the type is mismatched.

The following is not working as well
If xlbook.Worksheets(1).IsError(Cells(i, j)) = True ...

It's a good function (ISERROR) for a spreadsheet but
cannot be used like this in VB(no property).

Can anybody advise anything?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default worksheet error checking

Thanks, I've got it.
I'm using now:

If IsError(xlbook.Worksheets(1).Cells(i, j)) = True ...

It's working

-----Original Message-----
How could I check from VB whether a spreadsheet has any
errors?

I'm trying to use
If xlbook.Worksheets(1).Cells(i, j) = "#DIV/0!" Then ...
but the type is mismatched.

The following is not working as well
If xlbook.Worksheets(1).IsError(Cells(i, j)) = True ...

It's a good function (ISERROR) for a spreadsheet but
cannot be used like this in VB(no property).

Can anybody advise anything?

Thanks
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default worksheet error checking

Alex

If IsError(xlbook.Worksheets(1).Cells(i, j)) is the same

If IsError(xlbook.Worksheets(1).Cells(i, j)) =True

If Not(IsError(xlbook.Worksheets(1).Cells(i, j))) is the same

If IsError(xlbook.Worksheets(1).Cells(i, j)) =False

"AlexD" wrote in message
...
Thanks, I've got it.
I'm using now:

If IsError(xlbook.Worksheets(1).Cells(i, j)) = True ...

It's working

-----Original Message-----
How could I check from VB whether a spreadsheet has any
errors?

I'm trying to use
If xlbook.Worksheets(1).Cells(i, j) = "#DIV/0!" Then ...
but the type is mismatched.

The following is not working as well
If xlbook.Worksheets(1).IsError(Cells(i, j)) = True ...

It's a good function (ISERROR) for a spreadsheet but
cannot be used like this in VB(no property).

Can anybody advise anything?

Thanks
.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default worksheet error checking

Thanks, Carlos.

You are right.

-----Original Message-----
Alex

If IsError(xlbook.Worksheets(1).Cells(i, j)) is the same

If IsError(xlbook.Worksheets(1).Cells(i, j)) =True

If Not(IsError(xlbook.Worksheets(1).Cells(i, j))) is the

same

If IsError(xlbook.Worksheets(1).Cells(i, j)) =False

"AlexD" wrote in

message
...
Thanks, I've got it.
I'm using now:

If IsError(xlbook.Worksheets(1).Cells(i, j)) = True ...

It's working

-----Original Message-----
How could I check from VB whether a spreadsheet has any
errors?

I'm trying to use
If xlbook.Worksheets(1).Cells(i, j) = "#DIV/0!"

Then ...
but the type is mismatched.

The following is not working as well
If xlbook.Worksheets(1).IsError(Cells(i, j)) =

True ...

It's a good function (ISERROR) for a spreadsheet but
cannot be used like this in VB(no property).

Can anybody advise anything?

Thanks
.



.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default worksheet error checking

Alex,

You could use something like

Dim fError As Boolean
Dim cell As Range

For Each cell In Selection
With cell
fError = False
On Error Resume Next
fError = (.Value = CVErr(xlErrDiv0) Or _
.Value = CVErr(xlErrNA) Or _
.Value = CVErr(xlErrName) Or _
.Value = CVErr(xlErrNull) Or _
.Value = CVErr(xlErrNum) Or _
.Value = CVErr(xlErrRef) Or _
.Value = CVErr(xlErrValue))
End With
Debug.Print fError
Next cell

but it may get a bit onerous with a big range

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"AlexD" wrote in message
...
How could I check from VB whether a spreadsheet has any
errors?

I'm trying to use
If xlbook.Worksheets(1).Cells(i, j) = "#DIV/0!" Then ...
but the type is mismatched.

The following is not working as well
If xlbook.Worksheets(1).IsError(Cells(i, j)) = True ...

It's a good function (ISERROR) for a spreadsheet but
cannot be used like this in VB(no property).

Can anybody advise anything?

Thanks





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cross Checking - ERROR! alish Excel Discussion (Misc queries) 0 January 24th 08 12:32 PM
Error checking jason2444 Excel Discussion (Misc queries) 3 August 28th 07 09:29 PM
Error Checking SammyB Excel Discussion (Misc queries) 2 June 4th 07 10:48 AM
Error Checking Lost in Microbiology Excel Discussion (Misc queries) 8 May 11th 07 05:36 AM
Error Checking mworth01 Excel Discussion (Misc queries) 1 May 18th 06 08:45 PM


All times are GMT +1. The time now is 10:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"