3DWujWgX971XCJpTHA1aqC changeset

Changeset663061346233 (b)
ParentNone (a)
ab
0+Option Explicit
0+
0+Function IsInter(r As Range, t As Range) As Boolean
0+    Dim first As Range
0+    Set first = r
0+   
0+    Dim last As Range
0+    Set last = r.Cells(r.Count)
0+       
0+    If first.Row <= t.Row Then
0+        If t.Row <= last.Row Then
0+            If first.Column <= t.Column Then
0+                If t.Column <= last.Column Then
0+                    IsInter = True
0+                    Exit Function
0+                End If
0+            End If
0+        End If
0+    End If
0+    IsInter = False
0+End Function
0+
0+Private Sub Worksheet_Change(ByVal Target As Range)
0+    If IsInter(Range("A1:A10"), Target) Then
0+        If Target.Value <= 5 Then
0+            Call MsgBox("min")
0+        End If
0+    End If
0+   
0+    If IsInter(Range("A11:A15"), Target) Then
0+        If Target.Value <= 10 Then
0+            Call MsgBox("min")
0+        End If
0+    End If
0+   
0+    If IsInter(Range("B1:B15"), Target) Then
0+        If Target.Value <= 3 Then
0+            Call MsgBox("min")
0+        End If
0+    End If
0+End Sub
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
--- Revision None
+++ Revision 663061346233
@@ -0,0 +1,41 @@
+Option Explicit
+
+Function IsInter(r As Range, t As Range) As Boolean
+ Dim first As Range
+ Set first = r
+
+ Dim last As Range
+ Set last = r.Cells(r.Count)
+
+ If first.Row <= t.Row Then
+ If t.Row <= last.Row Then
+ If first.Column <= t.Column Then
+ If t.Column <= last.Column Then
+ IsInter = True
+ Exit Function
+ End If
+ End If
+ End If
+ End If
+ IsInter = False
+End Function
+
+Private Sub Worksheet_Change(ByVal Target As Range)
+ If IsInter(Range("A1:A10"), Target) Then
+ If Target.Value <= 5 Then
+ Call MsgBox("min")
+ End If
+ End If
+
+ If IsInter(Range("A11:A15"), Target) Then
+ If Target.Value <= 10 Then
+ Call MsgBox("min")
+ End If
+ End If
+
+ If IsInter(Range("B1:B15"), Target) Then
+ If Target.Value <= 3 Then
+ Call MsgBox("min")
+ End If
+ End If
+End Sub