|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Private Sub Worksheet_Change(ByVal Target As Range)
Dim cs, R As String
Cells(4, 4).Validation.Delete
If Target.Row = 4 And Target.Column = 4 Then
For Each sh In Sheets
If sh.Name <> "首页" And sh.Name <> "工地工时" And sh.Name <> "工地工资" And _
sh.Name <> "工作清单" And sh.Name <> "个人汇总" And sh.Name <> "下拉菜单" Then
With Sheets(sh.Name).Range("C5:C" & Sheets(sh.Name).[C65536].End(xlUp).Row)
Set cs = .Find(Target, LookIn:=xlValues)
If Not cs Is Nothing Then
firstAddress = cs.Address
Do
R = R + "," + cs
Set cs = .FindNext(cs)
Loop While Not cs Is Nothing And cs.Address <> firstAddress
R = Right(R, Len(R) - 1)
Cells(4, 4).Validation.Add 3, 1, 1, R
End If
End With
End If
Next sh
End If
Target.Select
End Sub
[ 本帖最后由 mineshine 于 2009-3-3 09:14 编辑 ] |
|