ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] vba¤¤iserror¥Îªk¡H

[µo°Ý] vba¤¤iserror¥Îªk¡H

½Ð°Ý
cells(1,1)=2
cells(1,2)=0
cells(1,3)=cells(1,1)/cells(1,2)

½Ð°Ý¦pªG·Q§PÂ_³o¤T®æ³£²Å¦X¤£¬°¥H¤Uªºª¬ªp®É¡A¤~¥h°µ¬Y¥ó¨Æ¡A¨º­n«ç»ò¼g¡A¦n¹³¤£¯à¥Îiserror(range("a1:c1"))
#DIV/0!
#N/A
#NAME?
#NULL!
#NUM!
#REF!
#VALUE!

Sub Test

If Not IsAnyErr(Range("a1:c1")) Then
  ' your code
End If

End Sub

Public Function IsAnyErr(Range As Range) As Boolean

For Each r In Range
    If IsError(r) Then
       IsAnyErr = True
       Exit Function
    End If
Next

End Function

TOP

¦^´_ 2# bobomi

¸U¤À·PÁ¦^ÂСI­ì¨Ó¬O¦h¤@­Ó¶}Ãö¡A¦pªG¬O´NÂ÷¶}

§Úªº·Qªk¤]¬O³o¼Ë¡A¤£¹L§Úªº¶}Ãö¤@ª½¨S¦³¼g¦n

ÁÂÁÂ

TOP

¦^´_ 1# joey0415

³o¸Ì¦³­Óºô­¶¤]¥i°Ñ¦Ò¬Ý¬Ý¡G

ExcelÄæ¦ì¤½¦¡±`¨£¿ù»~­ì¦]»P³B²z(#REF!¡B#VALUE!¡B...)
http://it.notes.tw/2009/11/excel-field-error.html

TOP

¦^´_ 4# Jerrywu101
³o¨Ç¬O¨ç¼Æªº¥Îªk¡I

§Ú­n°ÝÃD¬Ovbaµ{¦¡¤¤¥X²{¿ù»~®Éªº³B²z¡A«Ü¹³¡A¦ý³B²zªº¤è¦¡¤£¤@¼Ë®@

·PÁ¤À¨É

TOP

        ÀR«ä¦Û¦b : ÀR§¤±`®¦¤v¹L¡B¶¢½Í²ö½×¤H«D¡C
ªð¦^¦Cªí ¤W¤@¥DÃD