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

[µo°Ý] Excel 2010 Range/Cells Àx®æ­È³]©w¿ù»~,err.number= 1004

[µo°Ý] Excel 2010 Range/Cells Àx®æ­È³]©w¿ù»~,err.number= 1004

½Ð±M®a¤j¤j«ü¾É¡G
ÁÂÁÂ

Àx¦s®æA1 = testqq(B1) ¨ç¼Æ
§Q¥Î¦¹¨ç¼Æ³]©w Àx¦s®æ A3¡BB3¡BC3¡F ¦ý¬O¿ù»~ ¦pªþ¹Ï
  1. Public Function testqq(ByVal cc As Double) As Double
  2. Dim aa As Single, bb As Single
  3. aa = 5#
  4. bb = 6#
  5. Call qq(aa, bb)
  6. testqq = cc
  7. End Function

  8. Public Sub qq(ByVal aa As Single, ByVal bb As Single)
  9. Worksheets("RRE").Select
  10. Worksheets("RRE").Activate
  11. Err.Clear
  12. On Error GoTo errHandler
  13. Range("C3") = aa
  14. Cells(3, "A").Value = aa
  15. Cells(3, "B") = bb

  16. errHandler:
  17.     If Err.Number <> 0 Then
  18.         Debug.Print Err.Number, Err.Description, Err.Source
  19.         Resume Next
  20.     End If
  21.         
  22. End Sub
½Æ»s¥N½X

¦^´_ 1# Scott090
¤u§@ªí¤W¨Ï¥Î¦Û©w¨ç¼Æ:·|©¿²¤VBA¹ï¤u§@ªí¤èªk,ÄÝ©Ê...,¦ý¤£¥iµ¹Àx¦s®æ­È.
¦p¨S On Error GoTo errHandler  ¤u§@ªí¤Wªº testqq ¶Ç¦^¿ù»~­È

VBAµ{§Ç¤W¨Ï¥Î¦Û©w¨ç¼Æ«h¨S­­¨î¨ì
  1. Sub Ex()
  2.     testqq 5
  3. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 2# GBKEE


    ÁÂÁ¤j¤jªº«ü¾É¡A­T¶ë¹y¶}¡F
´±°Ý¤j¤j¬O§_¦³¨ä¥L¨±°jªº¤èªk¥i¥H¦b worksheet ©I¥s ¦Û­q¨ç¼Æ¦Ó¯à¶¡±µªº§âµ²ªG(2­Ó¥H¤Wªºµ²ªG­È)©ñ¨ì¬Y¦h¼Æ­Ó¦s®æ¤º?

TOP

¦^´_ 3# Scott090
VBAµ{§Ç¤W¨Ï¥Î¦Û©w¨ç¼Æ«h¨S­­¨î¨ì
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 4# GBKEE

·P®¦

³Ì«á¡A¦b¤u§@ªí³]©R¥O«ö¶s¸Ñ¨M¡F¥i±¤¨C¦¸ÅÜ´«¨ç¼Æ°Ñ¼Æ³£­n«ö¤@¦¸«ö¶s

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2014-2-20 11:47 ½s¿è

¦^´_ 5# Scott090

ThisWorkbook¼Ò²Õ,
  1. Option Explicit
  2. Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) '¬¡­¶Ã¯¤¤¤u§@ªí­«ºâ(¹w³])µ{§Ç
  3.     Dim F As Range
  4.     With Sh
  5.         Set F = .Cells.Find("=testqq", Lookat:=xlPart, LookIn:=xlFormulas)
  6.         If Not F Is Nothing Then
  7.         Application.EnableEvents = False
  8.             testqq (15)   '¥i±¤¨C¦¸ÅÜ´«¨ç¼Æ°Ñ¼Æ³£­n«ö¤@¦¸«ö¶s
  9.             '«ö¶sªºµ{¦¡½X
  10.         Application.EnableEvents = True
  11.           Exit Sub
  12.         End If
  13.     End With
  14. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 6# GBKEE


    ·PÁ ¶W¯Å°ª©úªº¤j¤jµ¹¤©¸ÔºÉªº¸Ñµª

TOP

        ÀR«ä¦Û¦b : ½_ÁJµ²±o¶V¹¡º¡¡A¶V·|©¹¤U««¡A¤@­Ó¤H¶V¦³¦¨´N¡A´N­n¶V¦³Á¾¨Rªº¯ÝÃÌ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD