Hi all,
Hope all are doing good.
Not sure if this is complex and challenging, but i will try to explain in full detail.
So i need help with a macro which will be placed in personal workbook so that it can be run in any file.
To explain briefly at first, there is 1 source workbook, 3 target workbooks and based on these aforementioned files, 2 destination workbooks need to be generated
The data is to be considered from source workbook, then find its relevant data in multiple target workbooks (wherever the data is present) and finally give the result in 2 destination workbooks in CSV format.
Source workbook and target workbooks will be open before macro is run. Macro will be run in source workbook. Finally 2 destination workbooks need to be created in CSV format and automatically save with a name followed by current date in a destination folder.
Source workbook =
Extract
Target Workbooks =
EMVS Alerts Log - CEE 2024
EMVS Alerts Log - DACH 2024 and
EMVS Alerts Log - Benelux 2024
Destination workbooks (CSV) =
import_alert_status_change_template (10-03-2024)
import_investigation_status_change_template (10-03-2024)
The value to be searched in file Extract is starting from row 2, column 1, first text up to semicolon i.e. "DE-92195aa3-e4e0-4a5d-91ea-60fc4c67af80"
This value need to be searched under column AE (UNIQUE_ALERT_ID) in target workbooks. Against this Alert ID, based on some column values, 2 CSV files need to be created automatically.
Also, the oldest date in file "Extract", which is after the Alert ID (between 1st and 2nd semicolon) shall be considered while searching such that the macro should start searching in target files one day before this date.
Example: If the oldest date in file Extract is 2nd March 2024, the macro should start searching from 1st March 2024 in target files under column A.
However, one issue here is that date format in file Extract is MM/DD/YYYY but in target files will be DD/MM/YYYY.
1st CSV file:
This shall always contain "Alert ID;Investigation Status" in row 1, column 1.
From row 2, it shall contain the alert IDs followed by either "Root cause on my side" or "No root cause on my side"
"Root cause on my side" or "No root cause on my side" will be populated by value under column AK in target workbooks.
If its GSK, then "Root cause on my side",
if its Non-GSK, then "No root cause on my side"
Example:
Alert ID in extract "DE-92195aa3-e4e0-4a5d-91ea-60fc4c67af80" in file "EMVS Alerts Log - DACH 2024" has "Non-GSK"under column AK. Hence the value in CSV file should be
DE-92195aa3-e4e0-4a5d-91ea-60fc4c67af80;No root cause on my side
Similarly for other Alert IDs.
Now this file should be saved as "import_investigation_status_change_template" followed by current date and saved in Downloads location of This PC.
Example: import_investigation_status_change_template (10-03-2024)
2nd CSV file:
This shall always contain "Alert ID;Status;Reason code;Custom reason" in row 1, column 1.
From row 2, it shall contain the alert IDs followed by "Under Investigation" and "RC-001" always, separated by semicolon.
Finally, it will contain the value under column AI in target workbooks against the Alert ID.
Example:
Alert ID in extract "DE-92195aa3-e4e0-4a5d-91ea-60fc4c67af80" in file "EMVS Alerts Log - DACH 2024" has "Pack active in ATTP, decommissioned elsewhere" under column AI. Hence this value in CSV file should be
DE-92195aa3-e4e0-4a5d-91ea-60fc4c67af80;Under Investigation;RC-001;Pack active in ATTP, decommissioned elsewhere
Similarly for other Alert IDs.
Now this file should be saved as "import_alert_status_change_template" followed by current date and saved in Downloads location of This PC.
Example: import_alert_status_change_template (10-03-2024)
The target workbooks contain column by name AMS Status under column AZ. Once an alert ID from file extract was found in target workbooks, then this column should be populated as Uploaded.
Finally, the rows 2 to 26 in file extract were found in the target workbooks and have value as Uploaded in target files under column AZ. So these rows should be deleted while others should remain in the file.
Also, from next time, when the macro is run, if the Alert ID in file "Extract" contains "Uploaded" in target file , then that row same shall be deleted from file Extract and others should be searched.
Note:
1. All target workbooks shall be open before running macro. If any of the workbook is not open, it should give a pop-up with the file name that is not open such as "EMVS Alerts Log - CEE 2024 is not open"
2. Target workbooks will always have same file names and sheet names. Sheets will always be password protected with "abc123"
3. In actual, there are 8 target workbooks. So i will add them in macro later on.
A query:
The target workbooks are placed on teams/sharepoint. Is it possible that if the link is entered in macro, then the macro should automatically search the data within them without the need of keeping all these files open.
Can someone please help with the macro?
Bookmarks