Oct 10 2023 10:16 PM - edited Oct 10 2023 10:16 PM
Hi All, thank you for taking your time to see this message. I hope it make sense.
i need help in create a VBA/Macro for searching data and compiling data.
i have 2 excel, Excel Test is where all the monthly report and sample consolidation report is
From Excel Test
SheetName PL_CompanyA, BS_CompanyA, PL_CompanyB, BS_CompanyB, PL_CompanyC, BS_Company C.
Each Sheet contain table as below not limited to the table A.
For PLSheet it contain such information
for each month 2023, every month when the report generated, the New month will be added.
For example, Feb 2023 is the latest month.
For this Excel,in PL_Company A, i will need to search for the latest month follow by Sales (Column A / Row 3) , then i will need to get the amount from (Column C / Row 3).
Next i will need to search for Cost of sales (Column A / Row 6) , then i will need to get the amount 6.00 from (Column C / Row 6).
There will be alot of search in Column A for getting the different amount in each month and i will need to do for the same for PL_Company B and PL_Company C Sheets.
Some have additional information to search from Column A. i believe i can modify once it.
For BS sheet will contain such information. I believe i can do it once i know how to search and get the data from PL sheet.
2nd Excel sample consolidation report
2023_PL sheet,it contain table like this.
From the data gotten from Excel Test PL sheet, i need to put them into here.
I will need to search for Company A, follow by the month latest month.
For example from the Excel Test the latest month is Feb, so i need to search for 2/28/2023.
then from Sales that is the amount 6.00 from (Column C / Row 6) in in Excel Test PL Sheet, I will need to put 6.00 into this 2023_PL sheet Column C Row 4.
and this goes on for the rest.
In my testing excel, i have done up to this code, which i am planning to get into the consolidation report excel.
Sub Get_Data_From_File()
Dim FileToOpen As Variant
Dim OpenBook As Workbook
Application.ScreenUpdating = False
FileToOpen = Application.GetOpenFilename(Title:="Browse for excel file", FileFilter:="Excel Files(*.xlsx*),*xlsx*", MultiSelect:=False)
If FileToOpen <> False Then
Set OpenBook = Application.Workbooks.Open(FileToOpen, ReadOnly:=True)
OpenBook.Sheets(1).Range("A5:D55").Copy
ThisWorkbook.Worksheets("Sheet1").Range("A5").PasteSpecial xlPasteValues
OpenBook.Close False
End If
Application.ScreenUpdating = True
End Sub
Thank you And many thank for taking your time to read and understand.
please do reach out to me if you need to explaining.
Oct 27 2023 09:42 PM