Jeffreyxx01
Board Regular
- Joined
- Oct 23, 2017
- Messages
- 156
Hi all,
I started a code but I am not too sure how to finish it and I am stuck.
I have hard coded data from A to J and I have created formula from K to V,
I have the unique code in column F, looks like this:
[TABLE="class: cms_table, width: 55"]
<tbody>[TR]
[TD]ABI001[/TD]
[/TR]
[TR]
[TD]ABI001[/TD]
[/TR]
[TR]
[TD]ABI001[/TD]
[/TR]
[TR]
[TD]ADA002[/TD]
[/TR]
[TR]
[TD]ADA002[/TD]
[/TR]
[TR]
[TD]ADA002[/TD]
[/TR]
</tbody>[/TABLE]
I want to be able to find the next unique code in column F, copy and paste the row K2:V2 at each new unique code,
Also I want to be able to create automatic sum of the column K at the end of the last unique code, so I want to sum the column J from first code ABI001 until the last one,
If anyone has an idea or need more explanation I can try explaining more.
Thanks a lot
I started a code but I am not too sure how to finish it and I am stuck.
Code:
Sub Copy_Paste_Loop()
Dim PrevPupilCode As String
Dim currentline As Integer
Dim currentPupilcode As String
Dim Sht As Worksheet
currentline = 2
PrevPupilCode = "nothing"
Do While (currentline <= maxNumberOfLines)
With currentPupilcode.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
If (currentPupilcode <> PrevPupilCode) Then
Sheets("Report").Range("K2:V2").Copy
End If
End Sub
I have hard coded data from A to J and I have created formula from K to V,
I have the unique code in column F, looks like this:
[TABLE="class: cms_table, width: 55"]
<tbody>[TR]
[TD]ABI001[/TD]
[/TR]
[TR]
[TD]ABI001[/TD]
[/TR]
[TR]
[TD]ABI001[/TD]
[/TR]
[TR]
[TD]ADA002[/TD]
[/TR]
[TR]
[TD]ADA002[/TD]
[/TR]
[TR]
[TD]ADA002[/TD]
[/TR]
</tbody>[/TABLE]
I want to be able to find the next unique code in column F, copy and paste the row K2:V2 at each new unique code,
Also I want to be able to create automatic sum of the column K at the end of the last unique code, so I want to sum the column J from first code ABI001 until the last one,
If anyone has an idea or need more explanation I can try explaining more.
Thanks a lot