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

[µo°Ý] Calculate¡A¯à§_¦^¶Çµo¥ÍÅܰʪºÀx¦s®æªºÄæ¦ì

¦]¬°¾ã±iªí³£¬O¤½¦¡¡Achange¨Æ¥óÀ³¸Ó¬O¤£·|³QIJ°Êªº
©Ò¥H¤~ª½±µ·Q¨ì¥Îcalculate
EXCEL VBA·s¤â¡A½Ð«e½ú¦h¦h«ü±Ð

TOP

¦^´_ 6# c_c_lai

ÁÂÁ§A¸Ô²Óªº¸Ñ»¡¡A²×©óÀ´¤F¡C
¨ä¹ê Private Sub Worksheet_Calculate()¨Ã¥¼¶Ç¤J°Ñ¼Æ¡A§Ú±N  If Target.Value = "YES" ¤¤ªº Target »~»{¬°¬O¶Ç¤J°Ñ¼Æ­È¡A¤~¥H¬°¬O C3¤½¦¡Ä²°ÊWorksheet_Calculate¡C
«á¨Ó¥J²ÓÆ[¹î Private Sub Worksheet_Change(ByVal Target As Range) ¤¤ªº If Target.Value = "YES" Then ®Ú¥»¤£·|°õ¦æ¨ì¡A¦] Target ¶È¦³A1¡BB1¡AC3¬O¤½¦¡¨S¦³Ä²µo¬O§Ú¦Û¤vÆ[¹î¤£°÷¡A§A¯u¬O ¥Î¤ß¨}­W¡C


Private Sub Worksheet_Calculate()
    Dim Target As Range
    Set Target = Range("C1")

    '  If Not Intersect(target, Range("C1")) Is Nothing Then
    If Target.Value = "YES" Then
        '  Run my VBA code
        MsgBox "Worksheet_Calculate is Activvated!"
    End If
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
    '  If Not Intersect(target, Range("C1")) Is Nothing Then
    If Target.Address = "$C$1" Then
        '  MyMacro()
        MsgBox "Worksheet_Change = " & Target.Address
    End If
End Sub
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

¦^´_ 11# ketrddem
§A¨Ï¥Î­þ¤@®a¨é°Ó³nÅé¡H

TOP

¡eIJ°Ê¡f»P¡eÅÜ°Ê¡fÀ³¬O¨â¦^¨Æ¡I
¡eIJ°Ê¡f«á¡A¤£¤@©w¤½¦¡­È¦³¡eÅÜ°Ê¡f¡A
­YÀx¦s®æ¤§¶¡¤S¦³ÃöÁp°Ñ·Ó¡A¤]³\¡e³s°Ê¡f¤]·|µo¥Í¡A
¨S¦³ÀɮסA³o¼Ë²q¤£¬O¿ìªk¡I¡I¡I

TOP

¦^´_ 13# c_c_lai


    ¤¸¤jRTD¡A¨S¦³¨Ï¥ÎDDE¡C

DDE¤Ó¤£¤è«K¤F¡AÁÙ¬ORTD¤ñ¸û¦n¥Î
EXCEL VBA·s¤â¡A½Ð«e½ú¦h¦h«ü±Ð

TOP

¦^´_ 15# ketrddem
RTD ¤£»Ý¥ý¶}±Ò¨é°Ó³nÅé¡A¥¦·|¦Û°Ê³sµ²¡A
³oºØ COM ªº¾÷¨î¤ñ¸û¦n¥Î¡C¥H«e¤]¨Ï¥Î¤¸¤j¡C
§Ú´¿¸g¤]¨Ï¥Î¹L Workbook_Calculate()
¦ý¬O¨s³º¬O­þ­ÓÄæ¦ì¦bIJµo¡AÄæ¦ì¦ì§}¬°¦ó¡A
«ÜÃø´x´¤¡A§A¥i¦³¦nªº Idea ¡H

TOP

¤p§Ì¤£¤~¡A¥u¦³·Qªk¡A¾ã­ÓEXCELÁÙ¨S¯uªº¼g§¹¾ã¡C
©Ò¥H´£¨Ñ¹Ï¨Ò¡A§Æ±æ¦U¦ì¯à´£¨Ñ¨Ç·Qªk¨Ñ¤p§Ì°Ñ¦Ò¡C

123.jpg (206.94 KB)

¹Ï¨Ò

123.jpg

EXCEL VBA·s¤â¡A½Ð«e½ú¦h¦h«ü±Ð

TOP

¦^´_ 16# c_c_lai


§Ú¦³·Q¹L¡A°}¦C¤ñ¹ï¡C

¨C¤Q¬í©Î¤G¤Q¬í¤ñ¹ï¤@¦¸¡C

°²³]
10:00¤À0¬í¡AÀx¦s¤º®e¬°°}¦C1
10:00¤À10¬í¡AÀx¦s¤º®e¬°°}¦C2

°}¦C1»P°}¦C2¤ñ¹ï¡A§ä¥X®t²§Äæ¦ì¡A©w¦ì¥XªÑ¸¹¤Î±ø¥ó­ì¦]
µM«á§â¸ê°T¼g¶i§OªºÀx¦s®æ
¼g¶i«á¡A°}¦C1§R°£¡A°}¦C2Åܧ󬰰}¦C1¡Aµ¥µÛ¤U­Ó¤Q¬í¦A°µ°}¦C2ªº¤ñ¹ï
¦ý¦³·Qªk«o¤£ª¾¬O§_¯u¥¿¥i¦æ¡A¼g¤F¤£ª¾¹ï¨t²Î·|¤£·|³y¦¨«Ü¤j­t¾á¡C
§ó­«­nªº¬O¡A¤p§Ì¹ï°}¦C¤£¤Ó¼ô¡C´Nºâ°}¦C¼g¥X¨Ó¡A¤]¤£ª¾¦p¦ó°µ¤ñ¹ï©w¦ì¡C
EXCEL VBA·s¤â¡A½Ð«e½ú¦h¦h«ü±Ð

TOP

¦^´_ 17# ketrddem

¥H³o¼Ëªºªí®æ, ¦P®É¦¨¥ß±ø¥óªº¥i¯à¤£¥u¤@­Ó, ¦Ó¥B¦Û°Ê­«ºâµLªk§P©w¬O­þ­Ó(¨Ç)Àx¦s®æ,
«Øij¤½¦¡§ï¬°:
=IF(±ø¥ó¦¨¥ß,"YES",0)

·íµo¥Í¨Æ¥óIJ°Ê,
Set Rng = [H:H].SpecialCells(xlCellTypeFormulas, 2)  '§ì¨ú¤½¦¡¤¤ªº[¤å¦r­È]Àx¦s®æ
¦A¥Î
For Each xR in Rng
    ³v¤@°O¿ý
next

TOP

¦^´_ 19# ­ã´£³¡ªL

­ã´£¤j¤j¡A©Ó»X§AÃö·Ó¡A¨S·Q¨ìªGµM§â±z³¨¥X¨Ó¤F¡C¥H«e¦b©_¼¯ª¾ÃÑ´Nµo¹L³\¦h°ÝÃD¡A¤]»X§A«ü¾É³\¦h¡C

³o­Ó¨Ò¤l¡A¨Ã¤£¬O­n¨úÀx¦s®æ¤¤ªº¤å¦r¡uYES¡v

¦Ó¬O­n¨ú¡uYES¡v³o­Ó­È¥¦ªº¦C¸¹¤ÎÄæ¦W¡A¥H«K±oª¾¬O¨º¤@¤äªÑ²¼(¦C¸¹)²Å¦X¤F¿ïªÑ±ø¥ó¡A¥H¤Îµo¥Í¦b¨º¤@ºØ±ø¥ó¤U(Äæ¦W)ªº¿ïªÑ±ø¥ó¡C

¹Ï¨Ò§ó§ï­è­è¤p§Ìµoªº¹Ï¡Aµo¿ù¹Ï¤F¡A³o±i«á­±ÁÙ¦³»¡©ú¡A¤ñ¸û§¹¾ã¡C

cats.jpg (262.69 KB)

cats.jpg

EXCEL VBA·s¤â¡A½Ð«e½ú¦h¦h«ü±Ð

TOP

        ÀR«ä¦Û¦b : §Ú­Ì­n°µ¦nªÀ·|ªºÀô«O¡A¤]­n°µ¦n¤º¤ßªºÀô«O¡C
ªð¦^¦Cªí ¤W¤@¥DÃD