Vikas Kumar
New Member
- Joined
- Apr 2, 2017
- Messages
- 49
Hi Friend,
I am trying to gather particular details from a bunch of workbooks located in a folder. Suppose I have a folder "PI 17 - 18" on my desktop which contains around 370 Performa Invoices. Now I want to collect only few details from each perfoma Invoice in below Format,
[TABLE="width: 500"]
<tbody>[TR]
[TD]Agency Name[/TD]
[TD]Adveriser[/TD]
[TD]Start Date[/TD]
[TD]Net Amount[/TD]
[/TR]
[TR]
[TD]A10:D10[/TD]
[TD]A18:B18[/TD]
[TD]E12[/TD]
[TD]G46[/TD]
[/TR]
</tbody>[/TABLE]
Above mentioned ranges capture corresponding details. I have tried to do the same with following Macro but unfortunately unable to get through,
Sub Example()
Dim Mypath As String
Dim wbk As Workbook
Dim Targetfile As Worksheet
'Where all files are located
Mypath = "C:\Users\VIKAS KUMAR\Desktop\PI 17 - 18"
'In this workbook I want to compile details (Unsaved)
Set Targetfile = ThisWorkbook.Sheets("Sheet1")
Do While Mypath <> ""
Set wbk = Mypath.Workbooks.Worksheets("Sheet1")
Range("A10:D10").Copy
Targetfile.Activate Range("A2").PasteSpecial
Range("A18:B18").Copy
Targetfile.Activate
ActiveCell.Offset(0, 1).PasteSpecial
Range("E12").Copy
Targetfile.Activate
ActiveCell.Offset(0, 1).PasteSpecial
Range("G46").Copy
Targetfile.Activate
ActiveCell.Offset(0, 1).PasteSpecial
ActiveCell.Offset(1, 0).Activate
Loop
End Sub
Also for ease attaching herewith a sample PI.
https://wetransfer.com/downloads/45...b650139259208470336fc0ff20170521112532/497196
Thanks for Help in advance.
I am trying to gather particular details from a bunch of workbooks located in a folder. Suppose I have a folder "PI 17 - 18" on my desktop which contains around 370 Performa Invoices. Now I want to collect only few details from each perfoma Invoice in below Format,
[TABLE="width: 500"]
<tbody>[TR]
[TD]Agency Name[/TD]
[TD]Adveriser[/TD]
[TD]Start Date[/TD]
[TD]Net Amount[/TD]
[/TR]
[TR]
[TD]A10:D10[/TD]
[TD]A18:B18[/TD]
[TD]E12[/TD]
[TD]G46[/TD]
[/TR]
</tbody>[/TABLE]
Above mentioned ranges capture corresponding details. I have tried to do the same with following Macro but unfortunately unable to get through,
Sub Example()
Dim Mypath As String
Dim wbk As Workbook
Dim Targetfile As Worksheet
'Where all files are located
Mypath = "C:\Users\VIKAS KUMAR\Desktop\PI 17 - 18"
'In this workbook I want to compile details (Unsaved)
Set Targetfile = ThisWorkbook.Sheets("Sheet1")
Do While Mypath <> ""
Set wbk = Mypath.Workbooks.Worksheets("Sheet1")
Range("A10:D10").Copy
Targetfile.Activate Range("A2").PasteSpecial
Range("A18:B18").Copy
Targetfile.Activate
ActiveCell.Offset(0, 1).PasteSpecial
Range("E12").Copy
Targetfile.Activate
ActiveCell.Offset(0, 1).PasteSpecial
Range("G46").Copy
Targetfile.Activate
ActiveCell.Offset(0, 1).PasteSpecial
ActiveCell.Offset(1, 0).Activate
Loop
End Sub
Also for ease attaching herewith a sample PI.
https://wetransfer.com/downloads/45...b650139259208470336fc0ff20170521112532/497196
Thanks for Help in advance.