First I want to express my appreciation for any assistance, as I have already spent quite a bit of time trying to figure this out.
Here is the situation. Company-wide Sales data (summary of all sales) comes from equipment vendors. An office person, takes this summary data, and breaks it down to the actual sales person. A 'Sales by Sales Rep' report is generated by the sales company's accounting system. It generates an Excel Spreadsheet. Only purpose is data output. It does not get edited any further.
My Access code, imports the Spreadsheet into tables, an parses the rows into tables that are used by a report that outputs data by Sales Rep grouped by customers. This is a daily report, and Access emails the reports to the Sales Reps via Outlook.
All this works perfectly. I get a copy just to monitor.
Now my client wants to do a similar report, except grouped by vendor, (because of sales quota analysis). With that data, I need to access the office managers's Excel spreadsheet which contains Sales Reps / Vendor / month quota sales amounts.
So, what is needed is to take data from an Access table, massage it a bit, then take a value pair, Sales Rep / Vendor, scan the Excel Spreadsheet for the Reporting Month, Sales Rep code / Vendor code pair, then populate the adjacent cell with the value.
My client's office person knows one thing, 'do it manually'. However, she has requested this to be automated to save at least a day of work. So, I can't tell her to redo the spreadsheet which she has been using for years. I have to work with what I got.
There are about 32 sales reps, so inefficient code is not a concern, as long as it works.
I have used the following code to open the spreadsheet.
--------------
'Code to open an Existing Excel Spreadsheet
Private Sub openSpreadsheet()
Dim xlsApp As Excel.Application
Dim xlsBook As Excel.Workbook
Set xlsBook = Workbooks.Open("Z:\Users\<username>\<dataFolder>\Commission 2013\201307\ARCOM13.xls")
Set xlsApp = xlsBook.Parent
xlsApp.Visible = True
End Sub
------------------
Now I need to know how to iterate through (read and analyse), find the cell by data comparison, then write data to the adjacent cell on the right.
So I would loop through the Access table, driven by Sales Rep Code,
then iterate through the Excel Spreadsheet to find the comparison data, then populate the associated cell with sales data.