Automatically transfer data from multiple workbooks into a master workbook

VARUNTEJA

New Member
Joined
Nov 9, 2017
Messages
1
Hi friends,
I am using the excel for my company billing purpose as it is already coded with the macros of auto-invoice generating and will save in the specified name as in a folder....As the files in the folder consists of the data's about the company name , truck no,materials, G.C.no and amount...so i need to extract the details of the concerned loading details...but i need only the specified details in that bill which will be in random spaces in the bill....but which will be common places in all the bills....

THIS IS THE FORMULA I AM USING....

Sub LoopThroughDirectory()
Dim MyFile As String, Filepath As String, rng As Range, wb As Workbook, i As Long, j As Long
MyFile = Dir("E:\data extract")
Filepath = "E:\data extract"
Do While Len(MyFile) > 0
If MyFile = "MASTER.xlsm" Then
Exit Sub
End If
Set wb = Workbooks.Open(Filepath & MyFile)
With wb.Sheets(1)
rngArr = Array("B7", "B8", "A12", "B12", "C12", "D12", "F12", "H12", "H7", "H8")
j = 0
For i = LBound(rngArr) To UBound(rngArr)
j = j + 1
.Range(rngArr(i)).Copy Workbooks("MASTER.xlsm").Sheets(1).Cells(Rows.Count, j).End(xlUp)(2)
Next
End With
wb.Close
MyFile = Dir
Loop
End Sub

BUT IN THE ABOVE FORMULA THE ROWS AND COLUMNS WILL ADD IF THERE IS A BLANK CELL...BUT SOMETIMES THE MENTIONED RANGE WILL BE A BLANK CELL IN SOME BILLS SO...IN MASTER FILE WHILE COPYING IF THERE IS A BLANK FILE ALSO I NEED THEM TO PASTE IN THE BILL ORDER ONLY NOT IN ANY BLANK CELL...


SO I REQUEST YOU GUYS TO PLEASE GIVE ME SOME SOLUTION FOR IT.....
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
You might stand a better chance of getting some help if
1) Reply to this post & repost your original question, BUT use the standard Font & size. Along with normal letter case (ie dont use all caps)
2) post the code between code tags(the # icon in the reply window).
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,314
Members
452,634
Latest member
cpostell

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top