我试图粘贴我创建的数组,我运行宏并且似乎没有问题,只是根本没有粘贴数组!
Private Sub Worksheet_Change(ByVal Target As Range)
Worksheets("Info").Range("A1").Select
Dim iLastRow As Long
iLastRow = ActiveSheet.Cells(ActiveSheet.Rows.Count, "A").End(xlUp).Row
Dim arrmatrix() As String
ReDim arrmatrix(1 To iLastRow)
For i = 1 To iLastRow
Range("A2").Cells(i, 1).Select
If Selection.Offset(11, 0) = "Pi emitida" Then
arrmatrix(i) = Range("A2").Cells(i, 1).Value
End If
Next i
Worksheets("Inicio").Range("G4").Value = arrmatrix()
End Sub
答案 0 :(得分:0)
worksheet_change
事件宏ReDim arrmatrix(1 To iLastRow, 1 to 1)
...
arrmatrix(i,1) = Range("A2").Cells(i, 1).Value
...
Worksheets("Inicio").Range("G4").Resize(ubound(arrmatrix,1)).Value = arrmatrix()
...