|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim r&
r = Sheet1.Cells(Rows.Count, 2).End(xlUp).Row
If Target.Value = "" Then Exit Sub
If r >= 17 Then MsgBox "表1--B8:B17区域数据已满", , "提示" '如果不需要提示删除该句即可
If Target.Value <> "" And Sheet1.Cells(8, 2) = "" Then
Sheet1.Cells(8, 2) = Target.Value
Else: If Sheet1.Cells(8, 2) <> "" And r < 17 Then Sheet1.Cells(r + 1, 2) = Target.Value '如果需要在B17以下顺序添加,删除 and r<17 + 提示句 即可
Cancel = True
End If
End Sub
根据2L的代码修改一下,本人技术一般,楼主可以看看是否符合要求。 |
|