![]() |
Vba Problem
Hi
I have a macro that does almost what i want, but it misses me some detail. The objective is to copy to other sheet some data, but this formula makes two things i cant control, it duplies information if i click 2 times macro button, and it goes to First row in the sheet i want. I would like to control this 2 elements. How can i? Thanks Sub Ferias2() For i = 7 To Cells(Rows.Count, "A").End(xlUp).Row If Cells(i, "A").Value = "1" Then With Worksheets("1") nextrow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1 End With Cells(i, "C").Resize(, 36).Copy Worksheets("1").Range("A" & nextrow) End If next i End Sub |
Vba Problem
Why not just copy/paste the data once?... Sub Ferias3() Dim i As Long Dim nextrow As Long i = Cells(Rows.Count, 1).End(xlUp).Row With Worksheets("1") nextrow = .Cells(.Rows.Count, 1).End(xlUp).Row + 1 End With Range("C7", Cells(i, 3)).Resize(, 36).Copy Worksheets("1").Cells(nextrow, 1) End Sub -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware "Micos3" wrote in message Hi I have a macro that does almost what i want, but it misses me some detail. The objective is to copy to other sheet some data, but this formula makes two things i cant control, it duplies information if i click 2 times macro button, and it goes to First row in the sheet i want. I would like to control this 2 elements. How can i? Thanks Sub Ferias2() For i = 7 To Cells(Rows.Count, "A").End(xlUp).Row If Cells(i, "A").Value = "1" Then With Worksheets("1") nextrow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1 End With Cells(i, "C").Resize(, 36).Copy Worksheets("1").Range("A" & nextrow) End If next i End Sub |
All times are GMT +1. The time now is 06:43 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com