Hi guys. Who can change the VBA code ?
The one user [B]maabadi[/B] helped me some time ago with VBA and writes me the code which can gather and take needed information from different Excels files from the folder and gather all needed info to one Excel file. It was the best program which I am using till nova day.
And now I responsible to one more new job to check some information from my Main Log and this job also have a lot of different Excel files in the folder.
I want again gather all needed information from different Excels into one Excel file for easy checking process. I appreciate If you can recommend to me course or good video lessons about VBA coding because I understood that it's easy way to organizing work with big Databases.
The old VBA code ( I don't know how it can be useful for you ) :
Excel File :
With yellow color I just show you what places for me important. ( Need info only from this place )
The Excels file which I have can consist from 1 Sheet or can consist from 6 Sheets.
The excel file which I have can consist from 1 Sheet or 6 Sheets.
How it should be or how I imagine how it should be, the ( 1st Version ) or ( 2d Version ) I don't know which easier fore you to create it . Its not matter fore me (as it will be convenient for you)
Example 1
Example 2
A small note about the Sheet if you can still add the Sheet to the left or wherever so that I can more accurately determine its position on the paper where I will enter the information.( In Hard copy with pen ):
Example 1
This post turned out to be a bit long and I think it won't scare you.?
I also wanted to thank all those who have read and spent their time to solve this problem, you are experts in your field.?
Thank you.
The one user [B]maabadi[/B] helped me some time ago with VBA and writes me the code which can gather and take needed information from different Excels files from the folder and gather all needed info to one Excel file. It was the best program which I am using till nova day.
And now I responsible to one more new job to check some information from my Main Log and this job also have a lot of different Excel files in the folder.
I want again gather all needed information from different Excels into one Excel file for easy checking process. I appreciate If you can recommend to me course or good video lessons about VBA coding because I understood that it's easy way to organizing work with big Databases.
The old VBA code ( I don't know how it can be useful for you ) :
VBA Code:
Sub ImportFiles3()
Dim xWS As Worksheet, xTWB As Workbook, DestSheet As Worksheet, Head As Range
Dim xStrAWBName As String, FolderName As String, sItem As String, Header As Long
Dim FolderPath As String, fldr As FileDialog, Lr As Long, LCD As Long, R As Long
Dim os As Long, LrS As Long, LCS As Long, FileName As String
On Error Resume Next
Set xTWB = ThisWorkbook
Set DestSheet = xTWB.ActiveSheet
Set fldr = Application.FileDialog(msoFileDialogFolderPicker)
With fldr
.Title = "Select a Folder"
.AllowMultiSelect = False
.InitialFileName = Application.DefaultFilePath
If .Show <> -1 Then GoTo NextCode
sItem = .SelectedItems(1)
End With
NextCode:
FolderName = sItem
Set fldr = Nothing
FolderPath = FolderName & "\"
FileName = Dir(FolderPath & "*.xls*")
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Application.DisplayAlerts = False
Do While FileName <> ""
Workbooks.Open FileName:=FolderPath & FileName, ReadOnly:=True
xStrAWBName = ActiveWorkbook.Name
For Each xWS In ActiveWorkbook.Sheets
If xWS.Name = "10140-CON-PIP-12" Then
Lr = DestSheet.Range("A" & Rows.Count).End(xlUp).Row
LrS = Application.WorksheetFunction.Count(xWS.Range("A11:A26"))
LCS = xWS.Cells(1, Columns.Count).End(xlToLeft).Column + 1
LCD = DestSheet.Cells(1, Columns.Count).End(xlToLeft).Column + 1
If Lr = 1 Then
Range(xWS.Cells(9, 1), xWS.Cells(10, 35)).Copy DestSheet.Range("B1")
Range(xWS.Cells(11, 1), xWS.Cells(11 + LrS - 1, 35)).Copy Range(DestSheet.Cells(3, 2), DestSheet.Cells(LrS + 2, 36))
DestSheet.Range("A1").Value = "Report Number"
Range(DestSheet.Cells(3, 1), DestSheet.Cells(LrS + 2, 1)).Value = xWS.Range("D7").Value
DestSheet.Cells(1, 37).Value = "Drawing"
Range(DestSheet.Cells(3, 37), DestSheet.Cells(LrS + 2, 37)).Value = Trim(Right(xWS.Range("V4").Value, Len(xWS.Range("V4").Value) - Application.WorksheetFunction.Find("/", xWS.Range("V4").Value)))
Range(xWS.Cells(9, 1), xWS.Cells(10, 35)).Copy
Range(DestSheet.Cells(1, 2), DestSheet.Cells(2, 37)).PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Range(xWS.Cells(11, 1), xWS.Cells(11 + LrS - 1, 1)).Copy
Range(DestSheet.Cells(3, 1), DestSheet.Cells(LrS + 2, 1)).PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Range(xWS.Cells(11, 1), xWS.Cells(11 + LrS - 1, 35)).Copy
Range(DestSheet.Cells(3, 2), DestSheet.Cells(LrS + 2, 37)).PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Range(DestSheet.Cells(1, 2), DestSheet.Cells(2, 2)).Copy
Range(DestSheet.Cells(1, 1), DestSheet.Cells(2, 1)).PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Else
Range(xWS.Cells(11, 1), xWS.Cells(11 + LrS - 1, 35)).Copy Range(DestSheet.Cells(Lr + 1, 2), DestSheet.Cells(Lr + LrS, 36))
Range(DestSheet.Cells(Lr + 1, 1), DestSheet.Cells(Lr + LrS, 1)).Value = xWS.Range("D7").Value
Range(DestSheet.Cells(Lr + 1, 37), DestSheet.Cells(Lr + LrS, 37)).Value = Trim(Right(xWS.Range("V4").Value, Len(xWS.Range("V4").Value) - Application.WorksheetFunction.Find("/", xWS.Range("V4").Value)))
Range(xWS.Cells(11, 1), xWS.Cells(11 + LrS - 1, 35)).Copy
Range(DestSheet.Cells(Lr + 1, 2), DestSheet.Cells(Lr + LrS, 37)).PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Range(xWS.Cells(11, 1), xWS.Cells(11 + LrS - 1, 1)).Copy
Range(DestSheet.Cells(Lr + 1, 1), DestSheet.Cells(Lr + LrS, 1)).PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End If
End If
Next xWS
Workbooks(xStrAWBName).Close
FileName = Dir()
Loop
DestSheet.Columns("A:AK").WrapText = False
DestSheet.Columns("A:AK").AutoFit
DestSheet.Name = "Consolidate"
xTWB.Save
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.Calculation = xlCalculationAutomatic
End Sub
Excel File :
10140-CON-PIP-45_W-0120.xlsx
drive.google.com
The Excels file which I have can consist from 1 Sheet or can consist from 6 Sheets.
The excel file which I have can consist from 1 Sheet or 6 Sheets.
How it should be or how I imagine how it should be, the ( 1st Version ) or ( 2d Version ) I don't know which easier fore you to create it . Its not matter fore me (as it will be convenient for you)
Example 1
Example 2
A small note about the Sheet if you can still add the Sheet to the left or wherever so that I can more accurately determine its position on the paper where I will enter the information.( In Hard copy with pen ):
Example 1
This post turned out to be a bit long and I think it won't scare you.?
I also wanted to thank all those who have read and spent their time to solve this problem, you are experts in your field.?
Thank you.