View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
uriel78 uriel78 is offline
external usenet poster
 
Posts: 38
Default autofill or copy & paste "till a value"

Thank you for your help...it gives an error 1004 at line "Loop Until
Cells(Rw, 3) = V"...I really don't know why....:-(



"Don Lloyd" ha scritto nel messaggio
...
Hi,

Sub CopyData()
Dim Rw, V, Rnge
V = Range("E1").Value
Rw = 0
Do
Rw = Rw + 1
Loop Until Cells(Rw, 2) = V
Rnge = "A1:D" & Rw
Range(Rnge).Copy Sheets("Sheet2").Range("A1")
End Sub

The value in E1 is stored in V. The DO loop goes down the rows looking for

V
in column 2 (B)
It adds Rw to the end of Rnge, copies the range to sheet 2, A!.

Don