Always Use Same Range For Chart, Even After Inserting Rows - excel

I currently have a macro that inserts new information every day in the top of a table and bumps the old data down. I want to have a chart that depicts the first 7 days of data.
What keeps happening is when the chart updates for the new day, the chart is still pulling data from the 7 previous days rather than bumping up to incorporate the newest day.
How Do I Fix This? I Essentially Just Want to Permanently Set where the charts data comes from so that it doesn't change when rows are inserted above.

I'd use the record macro option for this. Just start recording, update your references and stop recording. As you always want to use the same references you can record it once and you won't need to change anything in it, then you can just run that as part of your other macro.

Related

how to insert a date stamp into a table when a row is added automatically

I am wanting to update a table we have for outstanding issue in one of our projects so the date of issue being raised field is prepopulated when a new row is inserted in the table. the reason for doing this is I'm aware users occasionally will miss this field when adding data to the table and when going back it is hard to remember when you you raised the issue in the first place.
VBA is not my strong suit but I understand just about enough to get by and know the code I need for inserting the timestamp into a cell and just need to work out how to direct it to the right part of the table but that shouldn't just need to point it to the last row of the table and the column can be feed by its header.
What I'm more stuck on is how I get this done without having the user notice so no need for a macro button to add rows etc. I believe this should be doable using the change event handler but I just don't know enough about how I'd set this up. any advice would be appreciated
if you require any sample code I'm working or a mock up of the table let me know and i'll pull something together.

Excel Line Chart with separate data points for a single line

I have a weird problem that google's not being too kind on results (mostly basic things on how to create a line chart, or combination charts, neither of which I'm after).
I'm trying to automate a report we do each month, I've managed pretty well so far by having a linked excel chart and objects, I have a single sheet in excel I paste my formatted data (set format is consistent each month) then excel picks out the data, creates the charts and when opening powerpoint it reads it all in from there.
Great! Until I was given a new piece of information, there's monthly data and a yearly tally in my data, monthly data is shown with a particular "weighting" applied, year with a different one and it's this that's caused a problem.
The package that's exporting the data can't show these figures contiguously, so we have an export with all the monthly weights, then with annual weights.
So say originally we were looking at C83 to O83 for our data for this year, we're now looking at C83 to N83 and O1364.
I've tried to look at how I would add this to the chart, which currently has the reference:
='Monthly Data to Update'!$C$83:$O$83
But doing anything + or & doesn't seem to work.
So, I decided to just pull all my data in to contiguous set to reference, (so ='Monthly Data to Update'!C83 one cell, ='Monthly Data to Update'!C84 next cell and so on).
This caused a problem for future months that're empty, having 0's in them, so I updated my code to check:
=IF('Monthly Data to Update'!C83=0,NA(),'Monthly Data to Update'!C83)
And this works, my table below my chart is blank for the empty months, my chart doesn't try and plot these empty months. Hurrah!
Now, the wrinkle. The Yearly nets aren't charted but are displayed in the table (I'm not up on Excel charts so how this was originally setup, I just copied the charts from Powerpoint in to Excel and reset the data to where it needed to be before copying it back to Powerpoint as a data linked chart).
First chart I did, works fine, second chart I did it's decided to start plotting the annual net for two of the three lines = \
So, this is how my chart looks like, running off the contiguous (but wrong) data:
And this is how it looks running off the fetched contiguous (correct) data:
It's really baffling, Exceeded and Met now plot the Year to Date figure, whereas Not Met behaves as it should, and they all have the same data layout (on the right) using the same formulas (just pointing at different cells).
I am confused..
I'm hoping to keep this light and simple so have avoided using any macro's to date, so that down the line when I hand this project over to someone any maintenance should be easy to do (say add a chart) without them asking me and me then having to remember what the hell I did a few months ago.. - so if this is doable without going down that line (which, seems like it should be, given my first chart the two lines there worked fine, and one of the three in this is behaving itself).
Apologies for the long winded description, I've given full history so if there's a step further back I could've done better, then happy to fix it up there rather than where I got to.
Ah, so apparently I could've had non-contiguous data with a comma, not a plus or ampersand, so the chart data would be:
=('Monthly Data to Update'!$C$83:$N$83,'Monthly Data to Update'!$O$1404)
So I don't need to rebuild the data in to a contiguous set, and my charts don't cock up when selecting the data this way, win's all around.
Thank you for your time, hopefully this helps someone in the future. (as a saving grace for my lost morning)

Set specific height for all existing/new rows of a table

I have used Excel for quite some time now but only using traditional formulas. Now I am trying to create a more elaborated document for my business using VBA coding to expand my possibilities.
I have done some research and started practicing but found something that I can’t understand how to do yet.
I have a worksheet with a table on it. Since this is a fresh document it has nothing but the header and a blank row below it. What I always did when writing the information was type text in any of the columns that belong to the row immediately below the table (without actually inserting a new row myself). This creates a new row for the table where most of its format is kept, such as text size and formulas. However, I noticed that the row height doesn’t automatically change to that of the previous rows of the table, and changing it manually for each new row is very time consuming.
I would really appreciate it if anyone could share me the necessary Excel VBA code to fix this issue. I have thought of two possible approaches. The first one is a code that automatically sets all the rows of the table to a height of 20 (I want all rows to be the same size so no problem with that), supposing this would also affect new rows as I add them the way I mentioned. The second one would be a code that automatically sets every new row of the table to a size of 20. It doesn’t matter which one you choose, the easiest will be just fine. Thanks in advance.

Excel: Resetting table based on day

I'm gonna start by saying that I am not that experienced in excel and whatnot but I can manage with some instructions although I ran into a bit of a problem.
So, I've got a timesheet that supposedly tracks the start time, end time, project name and all those things, mind you, not a weekly timesheet, but a daily timesheet. I also have a row above all those columns showing the date and like I said, I'm not that experienced, I resorted to a drop down list with each day and month.
Now, the problem is, instead of copying the same table over and over again in a sheet, I want instead, whenever I change the date from the drop down list, all the cells that include the start time, end time, project name etc. to "reset" and likewise whenever I go back to a date that I've added data previously, to appear.
Is there any way in which I can do this ? Thank you!

Automatically update graph - Excel

I am trying to make an automatically updating graph.
This is what I am tring to do:
I am updating my data every day. So let's say I have the number 3000. I want today's date linked with that number.
So on 27-10 - 3000. And I want to add data every day. So on 28-10 it's 3010. etc. etc.
But I want to do this automatically. So every day the graph automatically adds the new data with current date.
I am unfamiliar with graphs and no clue how to do this. The only thing I know is the function TODAY() and that the data is always in a single cell: I8.
Any Help is much appreciated :)
Create a dynamic named range for your data (using OFFSET to dynamically include all new values). Example: http://analystcave.com/excel-dynamic-named-range/
Create a pivot table based on that data
Make a macro for refreshing the Pivot Table when data is updated (can record it with Macro Recorder) e.g.
See example below:
ActiveSheet.PivotTables("PivotTable1").PivotCache.Refresh
You can add this macro to the ActiveSheet change event or better even add a button to refresh the chart.

Resources