View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Bernie Deitrick
 
Posts: n/a
Default Problem in macro

Micos,

Change

Resize(, 10)

to

Resize(, 5)

HTH,
Bernie
MS Excel MVP


"Micos3" wrote in message
...
I got this macro that all the letters "K" that are printed in row B, send to
sheet2 by order all the line of that letter starting in row B.

What i want is to limit the rows that are copy to sheet2, cos in Macro in
sheet1 i copy all the rows after row "C", to sheet2, but i want to limit the
copy since "C" to row "G", can anyone help me?

Thanks

Sub comlin4()
Dim i As Long
Dim nextrow As Long

With ActiveSheet
For i = 2 To .Cells(.Rows.Count, "B").End(xlUp).Row
If .Cells(i, "B").Value = "K" Then
With Worksheets("Folha2")
nextrow = .Cells(.Rows.Count, "B").End(xlUp).Row + 1
End With
.Cells(i, "C").Resize(, 10).Copy Worksheets("Folha2").Range("B"
& nextrow)
End If
Next i
End With

End Sub