|
Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = True
Set d = CreateObject("scripting.dictionary")
If Target.Column = 7 And Target.Row > 7 And Target.Row < 17 Then
'If Sheet1.ProtectContents Then Sheet1.Unprotect Password:="1111"
If Range("G8") <> "" Then a = Sheet1.Range("D8"): d(a) = ""
For i = 8 To 16
If Sheet1.Cells(i, "G") = "" Then a = a & "→" & Sheet1.Cells(i - 1, "G"): Exit For
If Not d.exists(Sheet1.Cells(i, "G").Value) Then
d(Sheet1.Cells(i, "G").Value) = ""
a = a & "→" & Sheet1.Cells(i, "G")
End If
Next
Range("G32") = a
'Sheet1.Protect Password:="1111", DrawingObjects:=1, Contents:=1, Scenarios:=1
Application.ScreenUpdating = True
End If
End Sub
上面的代码是根据最后一个城市跟第一个城市一致来处理的 |
评分
-
1
查看全部评分
-
|