excel的宏坏了,请高手帮忙修复,是关于输入首字母出现下拉菜单的宏
发布网友
发布时间:2022-04-28 15:19
我来回答
共1个回答
热心网友
时间:2022-06-19 09:25
试试看是否完美:
Sub 添加()
Dim arr, i, j, v, ok
If arr(1, 1) <> "" Then
arr = Cells(1, 1).CurrentRegion
v = Trim(Cells(1, 1))
ok = True
For i = 2 To UBound(arr)
If Trim(arr(i, 1)) = v Then
ok = False
Exit For
End If
Next i
If ok Then
i = UBound(arr) + 1
Cells(i, 1) = v
Cells(i, 2) = Cells(i - 1, 2) + 1
Cells(2, 2).Formula = "VLOOKUP(A2,A3:B" & i & ",2,FALSE)"
End If
End If
End Sub