May 8, 2019
Hello,
I have cut a small section of a report that i want to create a code for. The idea is to cut the notes on column P from yesterday to today's report so i don't have to manually cut and paste them.
Goal: If PO number from column B(Purchase Order Details by Vendor (2019-11-01)) is equal to PO number from previous day(Purchase Order Details by Vendor (2019-10-31)) then copy the notes to column P for today's workbook.
Challenges: the PO# will be on a different row day by day as Purchase orders close or open.. so for example PO 009313 might not be on row 26 on Nov 2nd's report.
I only got the code to open the workbooks on my desktop and i am still researching on how to do the rest.
What i got so far:
Option Explicit
Sub Open_workbook_Basic()
Dim dd As Integer
Dim mm As Integer
Dim yy As Integer
dd = Day(Date)
mm = Month(Date)
yy = Year(Date)
Workbooks.Open Filename:="C:\Users\Eric Lau\Desktop\CCI\Purchase Order by Vendor REports\Purchase Order Details by Vendor (" & yy & "-" & mm & "-" & dd & ")"
Workbooks.Open Filename:="C:\Users\Eric Lau\Desktop\CCI\Purchase Order by Vendor REports\Purchase Order Details by Vendor (" & yy & "-" & mm & "-" & dd-1 & ")"
End Sub
I would appreciate it if anyone can help with creating the code or linking resources or older posts that have requested the same thing.
Thank you for your help!
Power Query
Power Pivot
Xtreme Pivot Tables
Excel for Decision Making
Excel for Finance
Excel Analysis Toolpak
Power BI
Excel
Word
Outlook
Excel Expert
Excel Customer Service
PowerPoint
November 8, 2013
Hi Eric,
The easiest way is to use Power Query to take the data from those 2 files and combine the information, a visual basic solution is much more difficult to implement, to cover all scenarios (including error checks, in case the file you refer does not exist in folder).
There is no unique match though, an order may be found in more than one row. This means that there may be multiple comments for the same order, not just one, what do you want to do in these cases?
May 8, 2019
Hi Catalin,
I am intrigued by the use of Power Query to accomplish this. How will you go about accomplishing this?
As for the comments, if the same PO number exist for line 10 & 11 per se, i would want the comment pasted on line 10 for line 10 and line 11 for 11.
Thank you for your advice and help in advance.
-Eric Lau
Power Query
Power Pivot
Xtreme Pivot Tables
Excel for Decision Making
Excel for Finance
Excel Analysis Toolpak
Power BI
Excel
Word
Outlook
Excel Expert
Excel Customer Service
PowerPoint
November 8, 2013
That will not work, as you clearly mentioned that the PO might be on a different row in the second file, a UNIQUE identifier is required. I tried to use a second column (warehouse id) as a second key to create a unique identifier, but there are still duplicates.
See the file attached for an example. Change the path to the files in settings, then press refresh All in Data tab. I used for testing the file provided and a copy of the same file, might need adjustments if your real files don't have the same structure.
May 8, 2019
Hello,
Sorry for the late response. I am doing some research on this tool as well but I replaced the link with the desktop link and refreshed. It gave me an error saying : [Expression.Error] The column 'Austin Foams Plastics' of the table wasn't found.
What is wrong with the tables? Thanks in advance.
1 Guest(s)