- ©«¤l
- 1018
- ¥DÃD
- 15
- ºëµØ
- 0
- ¿n¤À
- 1058
- ÂI¦W
- 0
- §@·~¨t²Î
- win7 32bit
- ³nÅ骩¥»
- Office 2016 64-bit
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ®ç¶é
- µù¥U®É¶¡
- 2012-5-9
- ³Ì«áµn¿ý
- 2022-9-28
|
¥»©«³Ì«á¥Ñ stillfish00 ©ó 2013-11-13 00:27 ½s¿è
¦^´_ 4# ui123
¥L¬OC/C++¼gªº¡A§ï¦¨VBA¤j¬ù¦p¤U- Function pointInPoly(ptx As Double, pty As Double, arPoly) As Boolean
- Dim i As Long, j As Long
- Dim pix As Double, piy As Double
- Dim pjx As Double, pjy As Double
-
- For i = 1 To UBound(arPoly) - 1
- j = i + 1
- pix = arPoly(i, 1): piy = arPoly(i, 2)
- pjx = arPoly(j, 1): pjy = arPoly(j, 2)
-
- '¤£¥]§tÂI¦b¦hÃä§Î½u¤W
- If Not (piy > pty) = (pjy > pty) Then
- If ptx < (pjx - pix) * (pty - piy) / (pjy - piy) + pix Then pointInPoly = Not pointInPoly
- End If
- Next
- End Function
½Æ»s¥N½X §Q¥Î¥L¼g¤@Ó¦Ûq¨ç¼ÆRegionABC- Function RegionABC(x As Double, y As Double, RegionA As Range, RegionB As Range, RegionC As Range) As String
- '¤£¥]§tÂI¦bABCÃä½t
- If pointInPoly(x, y, RegionA.Value) Then RegionABC = "A": Exit Function
- If pointInPoly(x, y, RegionB.Value) Then RegionABC = "B": Exit Function
- If pointInPoly(x, y, RegionC.Value) Then RegionABC = "C": Exit Function
- RegionABC = "¤£¦bABC"
- End Function
½Æ»s¥N½X ¥ý¸É»ôB°ÏªºÂI¡A
¨Ï¥Î¡A¨Ò¦p¦bO4¤½¦¡¥´¤W "=RegionABC(M4,N4,$C$4:$D$8,$C$10:$D$16,$C$18:$D$22)" |
|