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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim aName As String
Dim myDocument As Worksheet
Dim shp As Shape
Dim i As Integer, j As Integer, k As Integer, l As Integer, m As Integer, n As Integer, o As Integer, p As Integer, q As Integer, r As Integer, s As Integer, t As Integer, u As Integer, v As Integer, w As Integer, x As Integer
aName = ActiveSheet.Name
Set myDocument = Worksheets(aName)
For Each shp In myDocument.Shapes
If Not Intersect(myDocument.Range("CONTINENTAL1"), shp.TopLeftCell) Is Nothing Or _
Not Intersect(myDocument.Range("CONTINENTAL1"), shp.BottomRightCell) Is Nothing Then
i = i + 1
End If
If Not Intersect(myDocument.Range("CONTINENTAL2"), shp.TopLeftCell) Is Nothing Or _
Not Intersect(myDocument.Range("CONTINENTAL2"), shp.BottomRightCell) Is Nothing Then
j = j + 1
End If
If Not Intersect(myDocument.Range("CONTINENTAL3"), shp.TopLeftCell) Is Nothing Or _
Not Intersect(myDocument.Range("CONTINENTAL3"), shp.BottomRightCell) Is Nothing Then
k = k + 1
End If
If Not Intersect(myDocument.Range("CONTINENTAL4"), shp.TopLeftCell) Is Nothing Or _
Not Intersect(myDocument.Range("CONTINENTAL4"), shp.BottomRightCell) Is Nothing Then
l = l + 1
End If
If Not Intersect(myDocument.Range("CONTINENTAL5"), shp.TopLeftCell) Is Nothing Or _
Not Intersect(myDocument.Range("CONTINENTAL5"), shp.BottomRightCell) Is Nothing Then
m = m + 1
End If
If Not Intersect(myDocument.Range("CONTINENTAL6"), shp.TopLeftCell) Is Nothing Or _
Not Intersect(myDocument.Range("CONTINENTAL6"), shp.BottomRightCell) Is Nothing Then
n = n + 1
End If
If Not Intersect(myDocument.Range("CONTINENTAL7"), shp.TopLeftCell) Is Nothing Or _
Not Intersect(myDocument.Range("CONTINENTAL7"), shp.BottomRightCell) Is Nothing Then
o = o + 1
End If
If Not Intersect(myDocument.Range("CONTINENTAL8"), shp.TopLeftCell) Is Nothing Or _
Not Intersect(myDocument.Range("CONTINENTAL8"), shp.BottomRightCell) Is Nothing Then
p = p + 1
End If
If Not Intersect(myDocument.Range("CONTINENTAL9"), shp.TopLeftCell) Is Nothing Or _
Not Intersect(myDocument.Range("CONTINENTAL9"), shp.BottomRightCell) Is Nothing Then
q = q + 1
End If
If Not Intersect(myDocument.Range("CONTINENTAL10"), shp.TopLeftCell) Is Nothing Or _
Not Intersect(myDocument.Range("CONTINENTAL10"), shp.BottomRightCell) Is Nothing Then
r = r + 1
End If
If Not Intersect(myDocument.Range("CONTINENTAL11"), shp.TopLeftCell) Is Nothing Or _
Not Intersect(myDocument.Range("CONTINENTAL11"), shp.BottomRightCell) Is Nothing Then
s = s + 1
End If
If Not Intersect(myDocument.Range("CONTINENTAL12"), shp.TopLeftCell) Is Nothing Or _
Not Intersect(myDocument.Range("CONTINENTAL12"), shp.BottomRightCell) Is Nothing Then
t = t + 1
End If
If Not Intersect(myDocument.Range("CONTINENTAL13"), shp.TopLeftCell) Is Nothing Or _
Not Intersect(myDocument.Range("CONTINENTAL13"), shp.BottomRightCell) Is Nothing Then
u = u + 1
End If
If Not Intersect(myDocument.Range("CONTINENTAL14"), shp.TopLeftCell) Is Nothing Or _
Not Intersect(myDocument.Range("CONTINENTAL14"), shp.BottomRightCell) Is Nothing Then
v = v + 1
End If
If Not Intersect(myDocument.Range("CONTINENTAL15"), shp.TopLeftCell) Is Nothing Or _
Not Intersect(myDocument.Range("CONTINENTAL15"), shp.BottomRightCell) Is Nothing Then
w = w + 1
End If
If Not Intersect(myDocument.Range("CONTINENTAL16"), shp.TopLeftCell) Is Nothing Or _
Not Intersect(myDocument.Range("CONTINENTAL16"), shp.BottomRightCell) Is Nothing Then
x = x + 1
End If
Next shp
Cells(27, 4).Value = i
Cells(27, 12).Value = j
Cells(27, 20).Value = k
Cells(27, 28).Value = l
Cells(27, 36).Value = m
Cells(27, 44).Value = n
Cells(27, 52).Value = o
Cells(27, 60).Value = p
Cells(27, 68).Value = q
Cells(27, 76).Value = r
Cells(27, 84).Value = s
Cells(27, 92).Value = t
Cells(27, 100).Value = u
Cells(27, 108).Value = v
Cells(27, 116).Value = w
Cells(27, 124).Value = x
End Sub |
Partager