发布网友
共1个回答
热心网友
咨询记录 · 回答于2021-11-10excel一个工作表输入数据另一工作表对应的位置显示'1.右击Sheet1页名称,选择查看代码。'2.把以下代码复制到代码区。'3.在Sheet1的A1单元格输入批号(若须在其它地方输入,请修改第3行)。'4.即可在Sheet2的A列显示该批号,并每批号预留20行。Private Sub Worksheet_Change(ByVal Target As Range)If Target.Count >1 Then Exit SubIf Target.Address = [a1].Address ThenWith Sheet2r_end = .Range("a65535").End(xlUp).Rowr = Int(r_end / 21) * 21 + 1If .Cells(r, 1) = "" Then.Cells(r, 1) = TargetElse.Cells(r + 21, 1) = TargetEnd IfEnd WithEnd IfEnd Sub