【发布时间】:2020-06-21 14:24:52
【问题描述】:
此代码是在其中一个线程上找到的。 与代码相关的一切都很有用,除了一个 也就是说,在执行代码之后,数据是 向上移动。我想要那一行,即 A 到 F 应该 变为空白,数据不向上移动。试着 从代码中删除 Shift:=xlShiftUp 但数据仍然是 在源文件 (Sheet1) 中向上移动。 代码是
私有子命令按钮1_Click() 调暗源作为范围,目标作为范围
With Worksheets("Sheet1")
Set Source = .Range("A3", .Range("A" & .Rows.Count).End(xlUp))
End With
Set Target = Source.Find(What:=DCNameTextBox1.Value, LookIn:=xlValues, LookAt:=xlWhole)
If Not Target Is Nothing Then
'Reference the next enmpty row on Sheet2
With Worksheets("Sheet2")
With .Range("A" & .Rows.Count).End(xlUp).Offset(1)
'.Range("A1:F1") is relative to the row of it's parent range
.Range("A1:F1").Value = Target.Range("A1:F1").Value
.Range("H1:J1").Value = Array(DCDateTextBox.Value, DispoTextBox.Value, ReasonTextBox.Value)
Set Source = .Range("A3", .Range("A" & .Rows.Count).End(xlUp))
End With
End With
Target.Range("A1:F1").Delete Shift:=xlShiftUp
MsgBox "Client has been moved to Discharge list."
Else
MsgBox "Client not found", vbInformation, "No Data"
End If
Range("A3").Select
结束子
【问题讨论】:
标签: shift