HarrisonChong
New Member
- Joined
- Nov 16, 2016
- Messages
- 10
Good day,
As below code, it copies whatever value in A1:C1 to empty row, start from E2:G2 (Credit goes to tygrrboi).
Can anyone help to modify the code, as I tried to modify myself and I have very limited knowledge in VBA, which I couldn't make it myself.
I have 5 input fields from different cell, which are C18, B3, C20, C22 and C24 (Input). I attempt to copy the value from these cells, then arrange in a proper manner as B41:B45 (As output).
Below is the explanation of where the input flow.
Whereas, C18 value goes to B41, B3 value goes to B42, C20 value in B43, C22 value in B44 and C24 value in B45.
However, when the button clicks for 2nd times, then the output will C41:C45 and on so (consider as infinite loop)
Appreciate of anyone who try to help, thank you.
As below code, it copies whatever value in A1:C1 to empty row, start from E2:G2 (Credit goes to tygrrboi).
Can anyone help to modify the code, as I tried to modify myself and I have very limited knowledge in VBA, which I couldn't make it myself.
I have 5 input fields from different cell, which are C18, B3, C20, C22 and C24 (Input). I attempt to copy the value from these cells, then arrange in a proper manner as B41:B45 (As output).
Below is the explanation of where the input flow.
Whereas, C18 value goes to B41, B3 value goes to B42, C20 value in B43, C22 value in B44 and C24 value in B45.
However, when the button clicks for 2nd times, then the output will C41:C45 and on so (consider as infinite loop)
Appreciate of anyone who try to help, thank you.
Code:
Private Sub CopyAcross_Click()Dim R As Range
Dim rSize As Integer, numCopies As Integer, i As Integer
Dim nextEmptyRow As Long
With ActiveSheet
Set R = .Range("A1:C1")
rSize = R.Count
LastRow = .Cells(.Rows.Count, rSize + 1).End(xlUp).Row
End With
numCopies = 3
For i = 1 To numCopies
R.Copy R.Offset(LastRow, i * rSize)
Next i
End Sub