Reputation: 55
What I'm trying to achieve is to copy the first three cells from sheet "Arkusz1" and paste them sheet "Arkusz2" to the first empty column and first empty row in that column. After this the process repeats. I have code which pastes it to the first empty row in column A but it doesn't work properly as described above. I will appreciate any help.
Skok = Sheets("Arkusz3").Range("B1").Value
ActiveCellRow = ActiveCell.Row
Dim NextRow As Range
Set NextRow = Range(A + 1 & Sheets("Arkusz2").UsedRange.Rows.Count + 0)
Worksheets("Arkusz1").Activate
Sheets("Arkusz1").Range("A1").Select
ActiveCell.Offset(Skok, 0).Activate
Range("A1", ActiveCell.Offset(-1, 0)).Select
Selection.Copy
Worksheets("Arkusz2").Activate
NextRow.PasteSpecial Paste:=xlValues, Transpose:=False
Application.CutCopyMode = False
Set NextRow = Nothing
Upvotes: 0
Views: 98
Reputation: 109
In this example I am taking A1, A2, A3 from sheet 1, and copying it to sheet 2. Then it will go down to the next set per iterate(A4, A5, A6 and so on). However, I'm not fully sure what you are expecting so this should be a good start.
Dim s1a1 As String, s1a2 As String, s1a3 As String
Dim s2a1 As Long, s2a2 As Long, s2a3 As Long
Dim i As Integer
s2a1 = 1
s2a2 = 2
s2a3 = 3
For i = 1 To 6
s1a1 = Worksheets("Arkusz1").Cells(1, "A")
s1a2 = Worksheets("Arkusz1").Cells(2, "A")
s1a3 = Worksheets("Arkusz1").Cells(3, "A")
Worksheets("Arkusz2").Range("A" & s2a1) = s1a1
Worksheets("Arkusz2").Range("A" & s2a2) = s1a2
Worksheets("Arkusz2").Range("A" & s2a3) = s1a3
s2a1 = s2a1 + 3
s2a2 = s2a2 + 3
s2a3 = s2a3 + 3
Next i
Upvotes: 1