Problem in macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
I tryed before to change that number in resize, but once i didn't knew what
could i do, i change and it didn't gave the same result, but now worked just
fine, and now i can see the light. :D


Many thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top