Dear All,
I have an Excel where i need to manually to copy the Amount, KG and Description based on number of Trip to Column A to C , is there any method to simplify.
Copy Data based on number of Trip
-
- 4StarLounger
- Posts: 516
- Joined: 21 Feb 2016, 02:52
Copy Data based on number of Trip
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78235
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Copy Data based on number of Trip
How about this macro?
Code: Select all
Sub CopyData()
Dim r As Long
Dim m As Long
Dim t As Long
Dim n As Long
Application.ScreenUpdating = False
Range("A3:C" & Rows.Count).ClearContents
m = Range("I" & Rows.Count).End(xlUp).Row
t = 3
For r = 3 To m
n = Range("I" & r).Value
Range("A" & t).Resize(n, 3).Value = Range("J" & r).Resize(1, 3).Value
t = t + n
Next r
Application.ScreenUpdating = True
End Sub
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 516
- Joined: 21 Feb 2016, 02:52
Re: Copy Data based on number of Trip
Hi Hans,
It is too perfect, thanks for your great solution.
It is too perfect, thanks for your great solution.