|
不知道对不对
- Sub pd()
- Dim x(1 To 9999), y(1 To 9999)
- a = Sheets("1").[a2].Value
- sp = Split(a, ";")
- For i = 0 To UBound(sp)
- b = Split(sp(i), ",")
- n = n + 1
- x(n) = Val(b(0))
- y(n) = Val(b(1))
- Next i
- 东经 = WorksheetFunction.Min(x)
- 西经 = WorksheetFunction.Max(x)
- 北纬 = WorksheetFunction.Max(y)
- 南纬 = WorksheetFunction.Min(y)
- With Sheets("查询")
- lr = .Cells(Rows.Count, 3).End(3).Row
- arr = .Range("C1:D" & lr)
- For i = 2 To lr
- jwd = Split(arr(i, 1), ",")
- Select Case Val(jwd(0))
- Case 东经 To 西经
- jd = 1
- Case Else
- jd = 0
- End Select
-
- Select Case Val(jwd(1))
- Case 南纬 To 北纬
- wd = 1
- Case Else
- wd = 0
- End Select
-
- If jd = 1 And wd = 1 Then
- arr(i, 2) = "Y"
- Else
- arr(i, 2) = "N"
- End If
- Next i
- .Range("C1:D" & lr) = arr
- End With
- End Sub
复制代码 |
|