|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Option Explicit
- Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
- On Error Resume Next
- Dim row%, col1%, col2%, brr
- If Target.Address(0, 0) = "L2" Then
- Cancel = True
- row = Application.WorksheetFunction.Match([M2], Columns(1), 0)
- col1 = Application.WorksheetFunction.Match([N2], Rows(6), 0)
- col2 = Application.WorksheetFunction.Match([O2], Rows(6), 0)
- brr = Range(Cells(row - 1, col1), Cells(row - 1, col2))
- Cells(row, col1).Resize(1, col2 - col1 + 1).Value = brr
- End If
- If Target.Address(0, 0) = "L3" Then
- Cancel = True
- row = Application.WorksheetFunction.Match([M3], Columns(1), 0)
- col1 = Application.WorksheetFunction.Match([N3], Rows(6), 0)
- col2 = Application.WorksheetFunction.Match([O3], Rows(6), 0)
- Cells(row, col1).Resize(1, col2 - col1 + 1).ClearContents
- End If
- End Sub
复制代码
|
|