Access data export to excel: 1 issue- count - excel

I have a button in access that runs queries and dumps the info into an Access table, then that table is used to populate an excel sheet. This excel sheet is then linked to a 2nd worksheet (B) that has the formatting needed to submit for state reporting. I am having an issue that I need to fix with my process.
I have a record count- currently on the top of the formatted worksheet, but it has to be at the bottom of my formatted worksheet- it needs to be in the A column on the row after the last entry. How do I do this as since there's no set row to show record count? 1 report it may be 5, next report may be 35 rows.
I do the record count from the original (un-formatted) excel sheet that has the data dumped from Access, so it's accurate. I just need help moving it! end
Thanks.

Related

What formula would I use to make a column automatically populate in excel when new data is loaded into a worksheet?

I am creating a report in Excel with 3 separate worksheets, the main one where data is reported and calculated, one for new data and one for old data. I want values in one column in the main worksheet to update when new information is moved into the new data worksheet but still see values that were in the old data that may have dropped off the new list.
Connect to an Excel table or range
Click the Data tab, then > From Table/Range.
https://support.office.com/en-ie/article/connect-to-an-excel-table-or-range-power-query-67538004-cd12-4b61-9cee-8720db1c7136

Clear additional rows when overwriting table data in Excel 2016

I have a daily task of overwriting data in a table. The number of rows fluctuates day-to-day, so I have to scroll to the bottom of the table to check if there are less rows than the overwritten data. If there are, I have to highlight the additional rows of "old" data and delete them. I'm trying to automate this process to either a) automatically delete old rows upon overwriting of table data or, b) create some sort of "alert" signaling there are old rows that need to be deleted. Thank you in advance.
For anyone interested, I've created a macro and button to delete all rows from the 6 tables. Here is an example of the code that deletes all rows from one table. I copy and pasted this with/end with statement for each of the 6 tables into one macro.
With Sheet1.ListObjects("Table3")
If Not .DataBodyRange Is Nothing Then
.DataBodyRange.ClearContents
.DataBodyRange.Delete
End If
End With

Column header validation with different sheets using macros

In Excel, I have 4 column headers (Id, Name, Age, Place).
I have 3 Excel worksheets with same column headers and different data.
I want to make a consolidated worksheet and the constraint is I have to check whether the column header is the same in all 3 worksheets and move it into the consolidated worksheet.
In the 1st worksheet I have values in the first row.
In 2nd worksheet, the first row is empty and the second row has data.
In 3rd worksheet, the first and second rows are empty and the 3rd row has data.
The 4th worksheet is the consolidated one. I want all 3 worksheet's data in this sheet.
How to do it with macros in vba?
There's built-in functionality for data consolidation.
You'll need to move your data so it's all on the same row but in the end will probably be much easier than writing code from scratch.
How to consolidate
Follow these steps to consolidate several worksheets into a master worksheet:
If you haven't already, set up the data in each constituent sheet by doing the following:
Ensure that each range of data is in list format. Each column must have a label (header) in the first row and contain similar data. There must be no blank rows or columns anywhere in the list.
Put each range on a separate worksheet, but don't enter anything in the master worksheet where you plan to consolidate the data. Excel will do this for you.
Ensure that each range has the same layout.
In the master worksheet, click the upper-left cell of the area where you want the consolidated data to appear.
Note: To avoid overwriting existing data in the master worksheet, ensure that you leave enough cells to the right and below this cell for the consolidated data.
Click Data → Consolidate (in the Data Tools group).
In the Function box, click the summary function that you want Excel to use to consolidate the data. The default function is SUM.
Here is an example in which three worksheet ranges have been chosen:
Select your data.
More information and the remaining instructions are at the source.
If you want to automate the process, record a macro as you performs the necessary steps and then you can edit as required.
See: Recording a Macro to Generate Code as well as Revising Recorded Visual Basic Macros. If you're not familiar with Excel (or whatever you're planning on automating with VBA), do that before attempting VBA.
This VBA tutorial is highly recommended: Excel VBA For Beginners and Microsoft's Documentation.

Pivot and automatic inclusion of new row nr data in Excel

I needed some guidance from your more experience excel pros. I have two sheets in my excel file.
Data
Pivot Data
I have my data in the "Data" sheet and I have created a Pivot sheet for sheet Data.
Everyweek, I delete my data in the Data sheet and paste new data.With this, my rows become more. to update my pivots, I need to go to data source and update it so it include all the rows.
Is there something I can do or write so the pivots automatically adjust to the size of the new paste data in the Data sheet?
If before deleting the data, it was on row 400, I then paste new data and the row number is now 800, how can I automate this process rather than going to each pivot and updating manually to the new row number so it captures all the new data?
Change your Data Source range to exclude row numbers, so say:
Sheet3!$A:$D
instead of:
Sheet3!$A1:$D400
This will however introduce a row in your PT of (blank) (if not already present there), though you might filter to hide that row.

Excel Don't Change Data on Refresh

I have two sheets in an XLS file. 1st Sheet pulls up some data from web and updated. 2nd Sheet is analysis of the data in Sheet-1.
Now whenever I refresh data in sheet-1, the data in cells in Sheet-2 automatically refreshes. I want to stop this. I want to cells become inactive in Sheet-2 and thus don't have any impact of refresh and their values remains the same even after refresh.
How, is this possible? In other words, when I refresh I want to see the previous analysis and new analysis both. But when I refresh the same, the previous data is lost.
Disable automatic calculation (file / options / formulas), i.e. choose "Manual calculation".
Activate the import sheet that loads data from web. Calculate (i.e. refresh) this sheet only (Menu: Formulas / Calculate Sheet).
Now, the import sheet should be up to date, but the second sheet should still show the old values.
To finally synchronize both sheets again, either activae automatic calculation, or just press (forces workbook calculation incl. all sheets).

Resources