Auto-generate excel file - VBA - excel

I am sitting with an issue relating to VBA in excel - i have been trying to search for a solution but is unable to find one.
I have a global report that is continuously updated with site locations and data on a global scale - the report showcase the pipeline for the upcoming fiscal year. However, the German locations require an additional separate report containing the same data + historical data (previous updates to the global report).
Currently, this is a manual effort, copy pasting data from one report to the other - so my question is. Is there a way to auto-generate and auto-update the German excel file, based on the global excel file continuously adding new sites and updating the local file? And if so, how? I assume the solution would be related to VBA and macros, but this is not my strongest side.
Thank you in advance!

Related

Excel Get Data links breaking

I made an excel workbook the pulls data from a comma separated value formatted .txt document.
The document is supposed to be updated automatically every month. This happens with a power automate script that scans my email and then saves the attachment into a SharePoint drive.
The document maintains the same name and format every month.
However, I am having an issue with the source link in excel getting broken after the document has been replaced.
Anyone know of a way to diagnose/repair this issue?
I am currently updating the link manually.
Your question is lacking debugging details. You didn't mention the data connector you are using. Make sure it's From SharePoint List and not the local copy of your SharePoint data.

Create Excel metadata using VBA to filter in sharepoint

I am trying to use metadata from an Excel file to use for filtering in our sharepoint libraby.
The excel file already contains dropdown menus to pick certain values from, which are then used to create a very lengthy filename. However for our new sharepoint libraby I would like to move those to metadata, so it can be made visible in sharepoint columns and users can filter.
The file is a template that should be filled by users and when ready saved after choosing certain values.
The creation of the filename is done in VBA and therefore all values I want to use are available there.
I've tried a number of approaches I found in forums using e.g. customdocumentproperties and made it work...sometimes... While it worked in the beginning, I cannot make it work now.
It seems changing the metadata is a problem. Creating the metadata fields for the first time worked, but then changing it, did not. I have the feeling I do not understand some basics on this action. Microsoft websites are not of any help here...
What is the best - flawless - way to use VBA to create, add, change metadata in the excel-file that can be made visiblle in the sharepoint library? And are there any typical problems?

Is there a way to create templates for worksheets and dashboards in tableau?

I need to create some visualizations based on departmental metrics to show quarterly progress of projects. I can upload the excel file and develop what I need. My question is how can I save these worksheets and dashboards, perhaps in some sort of a template, so when more data is entered into the excel file (current quarter progress) I can upload the revised excel file back into Tableau and use the same worksheets and dashboard to display the updated data?
No columns are changed within the excel file, we are just adding additional rows of data or updating dates in existing columns as projects pass milestones.
I am using Tableau Desktop 2019.4.3
I am very new to using Tableau and am looking forward to learning more. I hope my question makes sense and appreciate any feedback.
Actually you just need to replace the "old" excel file from the datasource pane.
Once you saved your twb/twbx file, when you get the new version of the file, just go to the datasource pane and replace the previous file with the new one.
If the structure (column names and types) is the same, your entire workbook (both worksheets and dashboards) will update.
[I assume you're talking about your worbook using just Tableau Desktop]

Copy and paste Excel rows between two workbooks based on criteria from exported Access data

I have no previous experience in Access, VBA coding or in Excel macros prior to teaching myself the past month via these forums. Thank you forums and contributors. I have enjoyed my Access learnings so far, the challenge that it has provided and appreciate any help that I can get. As such, the code and methods that I have used to this point may well be convoluted and confusing. I will do my best to provide relevant details and accurate terminology.
I work in a lab and I am creating an Access Form for semi-automated reporting. Samples are received from clients and are logged into the Excel Table R&D Log. The worksheet is InProcess. Samples are sorted based on the site in which they originate and given a one or two letter site code (G, D, WH, etc.) and an ID "yy-000" in separate Excel columns (i.e. D 18-096). Samples may be submitted for multiple analyses (Metals, Water, Soil, etc.) and may even have multiple rows of reporting if multiple analytes are identified in the sample. There are several other columns, such as receipt date, reporting date, units, etc. Once samples are reported, I manually copy and paste them into the Archived worksheet, and delete the record and blank row from the InProcess worksheet. Since one sample may have multiple analyses and even more potential results, each record would be reported on a new Excel row (with the same D 18-096 ID number). Thus, there is not a single unique identifier or primary key for each sample in the current format. R&D Log is updated manually by lab technicians and the worksheet InProcess is a linked table in an Access Database.
The Access Database is using two combo boxes on a Form frmInProcess to filter a Query qryInProcess of the linked table. The combo boxes are filtering the report destination (one client may receive multiple site codes) and the analysis (reports are separated based on type of analysis). The Query is also filtering out blank results and blank dates, so only completed samples will appear on the filtered Form. I have generated VBA code to this point that will export the Form to a .pdf, save the file with unique filename, and open outlook to mail out the report. I have also managed to export the filtered Form frmInProcess to an Excel file Access Test (not the linked file).
What I would like to do now is to automate the transfer of completed test results from the Excel worksheet R&D Log: InProcess to R&D Log: Archived and delete the record from the InProcess worksheet. I am not sure if I can export the filtered Form into a linked Excel table, or if I must use a separate Excel file (or if it even matters for simplicity of code?). I would now like to read the exported filtered Form in Excel Access Test, lookup matching rows in R&D Log based on several criteria (site, ID, Analysis, Analyte, Report Date) and automate the transfer of records between R&D Log worksheets. End result being that Access generates reports for completed tests, and the records are removed from InProcess testing and transferred to Archived testing in Excel. I am guessing that I may need to close the Access application and perform this in Excel. Hope this is easy enough to follow.
Thank you.
In my experience, importing an Excel document into a temporary NEW (or totally empty) Access table is usually the easiest way to go. Then you do not have to worry about cell references like you do in Excel VBA. Even if the Excel document has old data in it with just a few new changes each time, importing it into a temporary Access table could be the simplest way to go, because then you can compare the data in this table with the data in another, permanent Access table and update the latter based on the former.
As far as the original Excel file, if you need to delete rows there, it might be quicker to export a new Excel file with just the data the old one is supposed to end up with, and then use VBA to delete (or - safer! - rename) the old file.
So the development process goes something like this:
Save import steps by first importing an Excel file via Access' ribbon options "External Data" (tab) ->"Excel" and when you finish, be sure to check the "Save import steps" box and note the name you give the "saved import" because you will need that in your VBA code.
In Access, write a function for deleting the table. The VBA code is:
Const cTable = "MyExcelTempTable"
If TableExists(cTable) Then
DoCmd.DeleteObject acTable, cTable
End If
Now you can test your delete function on the data you imported.
Write VBA code to import the same spreadsheet to create the same table:
Const cSavedImport = "Import-MyExcelTempTable"
' Import the Excel file
DoCmd.RunSavedImportExport cSavedImport
Write more VBA function(s) to check the imported table for bad data and then to copy it into the permanent table. You might be updating existing records or adding new ones. Either way, you could use Access queries or SQL to do this and run them from VBA.
Write a VBA function to rename the old Excel file. (You could use an InputBox if the Excel file name is different each time. I do this for importing Excel files, and I set a default value so I do not have to type as much.)
Write a VBA function to export the new version of the Excel file.
Make yourself a button on a form that, when clicked, runs a VBA function. Inside that function, run Steps 2 through 6, above.
I am not sure my answer exactly matches what you are trying to do, but hopefully you get enough of a picture of the workflow to figure out the details of what you need.

Loading Multiple Sheets in QlikView

I have been working on creating a QlikView dashboard for my senior management to use, the current build uses a simple AccessDB back-end to source all tables loaded into the dashboard. However, due to our system limitations, if we'd like to host the dashboard on our intranet the back-end has to be switched to Excel.
Instead of creating multiple Excel files to load them up separately, I was thinking of connecting all my tables directly into Excel with multiple sheets representing multiple tables. By default when you load Excel into QV it only reads the first sheet, is there a way to get it to read all sheets in that Excel file?
Let me know your thoughts.
Regards,
Yasir
I saw the solution to this a few days ago. But I am not sure where is the post anymore or whether it works. Regardless, here is what I remember:
Here is the usual one:
(biff, no labels, table is [Table$])
But if you want to load all sheets,
(biff, no labels)
^In order to do this, make sure all sheets are in the same format/ table.
you need to set vFileName, vStartIndex, vEndIndex
// create a dummy table. it will be used in first concatenation
Excel:
Load * Inline
[DummyFiled];
// loop all your sheets and build Excel table
FOR index = vStartIndex TO vEndIndex
concatenate(Excel)
LOAD
*
FROM [$(vFileName).xlsx]
(ooxml, embedded labels, table is [Page $(index)]);
NEXT index;

Resources