View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Copy paste different size problem

Hi,

Am Fri, 27 Nov 2020 18:02:24 -0800 (PST) schrieb Xxer Xxes:

But I need this code to bring me the number of the adress of
the row which contain data . I.m pretty shure I'll be not bother
you too soon . I dont make wishes , i just have strongly need
this very clever type of code . Many thanks .


try:

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

With ActiveSheet
n = 1
For i = 51 To 1600
If Len(.Cells(i, "F")) 0 Then
ReDim Preserve varData(1 To 2, 1 To n)
varData(1, n) = .Cells(i, "F")
varData(2, n) = i
n = n + 1
End If
Next
.Range("F1").Resize(UBound(varData, 2), 2) = _
Application.Transpose(varData)
End With
End Sub


Regards
Claus B.
--
Windows10
Office 2016