Dim SLR As Range
Dim ELR As Range
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
On Error Resume Next
Select Case UCase(Target.Value)
Case "START-LOCATION"
Target.Offset(0, 0).Select
Selection.ClearContents
SLR = ActiveCell.Address
Target.Offset(-1, 1).Select
Case "END-LOCATION"
Target.Offset(0, 0).Select
Selection.ClearContents
ELR = ActiveCell.Address
Target.Offset(0, -1).Select
ActiveSheet.Range(SLR, ELR).FillDown
End Select
End Sub
大家好,我有上面的代码,它应该在第一个单元格的开始位置设置变量,在结束位置设置第二个变量,然后将单元格从 SLR 填充到 ELR,但是它不起作用并且没有向我提供错误消息,有什么想法吗?