如何在excel下用宏实现如下功能!谢谢
2个回答
展开全部
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Set Sh = Target.Parent
If Sh.Name = "工作表3" Or Sh.Name = "工作表2" Then
If Target.Column = 1 And Target.Count = 1 And Target = "V" Then
R = Sheets("工作表1").Cells(Rows.Count, 1).End(3).Row + 1
Sheets("工作表1").Cells(R, 1).Resize(, 3) = Target.Offset(, 1).Resize(, 3).Value
End If
End If
End Sub
代码复制到thisworkbook中
展开全部
Sub test()
row1 = Range("B65536").End(xlUp).Row
arr = Range("A1:D" & row1)
For i = 1 To UBound(arr)
If arr(i, 1) = "V" Then
brr = Array(arr(i, 2), arr(i, 3), arr(i, 4))
With Sheets("工作表1")
row2 = .Range("A65536").End(xlUp).Row + 1
.Range("A" & row2 & ":C" & row2) = WorksheetFunction.Transpose(WorksheetFunction.Transpose(brr))
End With
End If
Next
MsgBox "打完收工!"
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询