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

½Ð°Ý¦¹µ{§Ç«Å§i¥Î¨º­Ó¸û¬Ù¸ê·½??

½Ð°Ý¦¹µ{§Ç«Å§i¥Î¨º­Ó¸û¬Ù¸ê·½??

¥»©«³Ì«á¥Ñ t8899 ©ó 2014-10-12 14:51 ½s¿è

1. ½Ð°Ý¦¹µ{§Ç«Å§i¥Î¨º­Ó(©Î¦p¦ó­×§ï)¸û¬Ù¸ê·½??
2. ¥Î Private Sub Worksheet_Change() ¬°¦ó¥X²{ ¨Æ¥óµ{§Çªº«Å§i»P¦P¦W¨Æ¥óªº´y­z¤£¬Û²Å

Private Sub Worksheet_Calculate()
' Private Sub Worksheet_Change(ByVal Target As Range)
'  Private Sub Worksheet_Change()

Dim rng As Range
For Each rng In Range("AL5:AL15")  'Range("AL5:AL15") ¬°dde³sµ²
m = rng - rng.Offset(0, 9)
'------------------------------
If m > rng.Offset(0, 8) Then
MsgBoxTest 0, rng.Offset(0, -1) & "  ª`·N ", "´£¥Ü°T®§", vbSystemModal, 0, 2000
  Application.EnableEvents = False
rng.Offset(0, 9) = rng
Application.EnableEvents = True
End If
'------------------------------------------
If m < -rng.Offset(0, 8) Then
MsgBoxTest 0, rng.Offset(0, -1) & " ª`·N ", "´£¥Ü°T®§", vbSystemModal, 0, 2000
  Application.EnableEvents = False
rng.Offset(0, 9) = rng
Application.EnableEvents = True
End If
'------------------------------------------------
Next
End Sub

¥»©«³Ì«á¥Ñ GBKEE ©ó 2014-10-13 08:53 ½s¿è

¦^´_ 1# t8899


   
1. ½Ð°Ý¦¹µ{§Ç«Å§i¥Î¨º­Ó(©Î¦p¦ó­×§ï)¸û¬Ù¸ê·½??
2. ¥Î Private Sub Worksheet_Change() ¬°¦ó¥X²{ ¨Æ¥óµ{§Çªº«Å§i»P¦P¦W¨Æ¥óªº´y­z¤£¬Û²Å
¨Ì¾Ú§Aªº»Ý¨D«Å§iÅܼƪº«¬ºA »P ­þ¤@­Ó¸û¬Ù¸ê·½µLÃö?
½Ð¸Ô¬ÝVBAªº»¡©ú
  1. Dim A As Integer, B As Long, C As Single, D As Double
½Æ»s¥N½X
Private Sub Worksheet_Change(ByVal Target As Range)¬O¤u§@ªí¼Ò²Õªº¹w³]¨Æ¥óµ{§Ç
§A¤£¥i¥H¦b¤u§@ªí¼Ò²Õ¤¤¥t¨Ï¥Î©Ò¦³ªº¹w³]¨Æ¥óµ{§Çªº¦WºÙ,°µ¬°µ{§Çªº¦WºÙ

¤u§@ªí¼Ò²Õªº¹w³]¨Æ¥óµ{§Ç ¦p¹Ï

·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¥»©«³Ì«á¥Ñ t8899 ©ó 2014-10-13 06:59 ½s¿è
¦^´_  t8899


    ¨Ì¾Ú§Aªº»Ý¨D«Å§iÅܼƻP­þ¤@­Ó¸û¬Ù¸ê·½µLÃö?
½Ð¸Ô¬ÝVBAªº»¡©úPrivate Sub Workshee ...
GBKEE µoªí©ó 2014-10-13 05:45


1.target ¬O«ü§@¥ÎÀx¦s®æ¡AÁÙ¬O¤@¶ô°Ï°ì?
2.Private Sub Worksheet_Calculate()
   Private Sub Worksheet_Change(ByVal Target As Range)
¦¹¨âºØ«Å§i¦³¦ó¤£¦P?

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2014-10-13 07:35 ½s¿è

¦^´_ 3# t8899
¥i¦b¤u§@ªí¤W ¿ï¨ú¦h­«½d³òµM«á«ö¤U§R°£Áä
¸Õ¸Õ¬Ý
  1. Option Explicit
  2. Private Sub Worksheet_Change(ByVal Target As Range)
  3.     MsgBox Target.Count
  4.     'Dim e As Range
  5.     ' For Each e In Target
  6.     '   MsgBox e.Address
  7.     ' Next
  8. End Sub
½Æ»s¥N½X
Private Sub Worksheet_Change()
¨S¦³¹w³]¨Æ¥ó©Ò³]¥ßªº°Ñ¼Æ,µø¬°¤@¯ëµ{§Ç,©Ò¥HVBAµo¥X½sĶ¿ù»~ªº«H®§
** µ{¦¡¦WºÙ ,Åܼƪº«Å§i ¬Ò¶·ÁקK¨Ï¥Î»PVBA¤WªºÃöÁä¦r(ª«¥ó,¨ç¼Æ,ÄÝ©Ê,¤èªk)¬Û¦Pªº¤å¦r **
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_  t8899  
¥i¦b¤u§@ªí¤W ¿ï¨ú¦h­«½d³òµM«á«ö¤U§R°£Áä
¸Õ¸Õ¬ÝPrivate Sub Worksheet_Change()
¨S¦³¹w ...
GBKEE µoªí©ó 2014-10-13 06:59


1.Set rg = Intersect(Target, Range("AL5:AL15"))
For Each cl In rg
2.For Each rg In Range("AL5:AL15")
½Ð±Ð¦¹¨âºØ»yªk¦³¦ó¤£¦P???

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2014-10-13 07:57 ½s¿è

¦^´_ 5# t8899

  1. Option Explicit
  2. Private Sub Ex()
  3.     My_Worksheet_Change Selection   'µ{¦¡ (¶Ç»¼°Ñ¼Æ)
  4. End Sub
  5. Private Sub My_Worksheet_Change(ByVal T As Range)
  6.     Dim Rg As Range, e As Range
  7.     'Intersect ¤èªk ¶Ç¦^ Range ª«¥ó¡A¦¹ª«¥ó¥Nªí¨â­Ó©Î¦h­Ó½d³ò­«Å|ªº¯x§Î½d³ò¡C
  8.     MsgBox T.Address
  9.     Set Rg = Intersect(T, Range("AL5:AL15"))
  10.     If Rg Is Nothing Then Exit Sub
  11.     MsgBox Rg.Address
  12.     'For Each...Next ³¯­z¦¡ °w¹ï¤@­Ó°}¦C©Î¶°¦X¤¤ªº©Ò¦³¤¸¯À¡A­«½Æ°õ¦æ¤@¬q³¯­z¦¡¡C
  13.     For Each e In Rg
  14.         MsgBox e.Address
  15.     Next
  16.     For Each e In Range("AL5:AL15")
  17.         MsgBox e.Address
  18.     Next
  19. End Sub
  20. Private Sub Worksheet_Change(ByVal T As Range) 'Target ÅܼƦWºÙ ¥i­×§ï
  21.     Dim Rg As Range, e As Range
  22.     MsgBox T.Address
  23.     Set Rg = Intersect(T, Range("AL5:AL15"))
  24.     If Rg Is Nothing Then Exit Sub
  25.     MsgBox Rg.Address
  26.     For Each e In Rg
  27.         MsgBox e.Address
  28.     Next
  29.     For Each e In Range("AL5:AL15")
  30.         MsgBox e.Address
  31.     Next
  32. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_  t8899
GBKEE µoªí©ó 2014-10-13 07:55


ÁÂÁ«ü¾É!

TOP

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