View Single Post
  #10   Report Post  
Old November 28th 20, 02:22 AM posted to microsoft.public.excel.programming
Xxer Xxes Xxer Xxes is offline
external usenet poster
 
First recorded activity by ExcelBanter: Nov 2020
Posts: 33
Default Copy paste different size problem

Pe vineri, 27 noiembrie 2020, la 21:19:50 UTC+2, Claus Busch a scris:

Sub Test()
Dim i As Long, n As Long
Dim varData() As Variant

With ActiveSheet
For i = 101 To 1500
If Len(.Cells(i, "A")) 0 Then
ReDim Preserve varData(n)
varData(n) = .Cells(i, "A")
n = n + 1
End If
Next
.Range("A1").Resize(UBound(varData) + 1) = _
Application.Transpose(varData)
End With


Have a plesant night

Well , I try to use this code in a macro ,
to try see which work faster :

With ActiveSheet
For i = 101 To 1500
If Len(.Cells(i, "A")) 0 Then
ReDim Preserve varData(n)
varData(n) = .Cells(i, "A")
n = n + 1
End If
Next
..Range("A1").Resize(UBound(varData) + 1) = _
Application.Transpose(varData)
End With

now , I need to use Column F instead of column A ,
and this part code return me an error 9 ; I tried to change
"A" with "F" , but with the same error 9 return .