|
楼主 |
发表于 2004-3-19 14:24
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
实际上是通过宏监视用户的操作来实现
程序如下:
Private Sub Worksheet_Change(ByVal Target As Range) Dim NewEntry As String If Target.Cells.Count > 1 Then Exit Sub If Target = "" Then Exit Sub
If Not Intersect(Target, Range("A1:A3000")) Is Nothing Then NewEntry = "" NewEntry = Target If WorksheetFunction.CountIf(Sheet1.Range("Fruit"), NewEntry) = 0 Then Sheet1.Range("Fruit").End(xlDown).Offset(1, 0) = NewEntry Sheet1.Range("Fruit").Resize(Sheet1.Range("Fruit").Rows.Count + 1, 1).Name = "Fruit" End If End If
End Sub |
|