Macro To Create A Chart Over Used Range In Worksheet
Mar 20, 2012
I am trying to write a simple macro to create a chart over the used range in a worksheet. The first part of the macro correctly selects the used range which in this case is A1 to F19 when I single step through the macro. A listing of the macro is shown below:
Code:
Sub AddChartObject()
'
Sheets("Sheet1").Activate
Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
[Code]...
When I place the formula given in MyArea as an argument for the source data, I receive a syntax error, so obviously it is the wrong argument. Numerous attempts to correct it also failed. As a sanity check, I placed the used range in an argument for the source data and was able to create the expected chart. fix the syntax error in the macro
View 4 Replies
ADVERTISEMENT
Dec 5, 2006
I'm trying to loop through a worksheet where each row is an individual record. I need a macro to read the row and create a chart on a separate worksheet for that row, then move on until a chart has been created for each individual row. In English the problem is:
Read Row 1
Create chart based on row 1 data in new worksheet 1
Read Row 2
Create chart based on row 2 data in new worksheet 2
And so on
View 2 Replies
View Related
Jul 8, 2014
I have created a spreadsheet which uses data validation to allow a user to select a company, start Date, end date, and projected months in order to output different figures. I have attached a spreadsheet to this post in case that was hard to understand.
Since there is data validation, indexing, and matching going on, as different selections are made, various tables change as a result. Uou will be able to see what I mean as you open the example sheet and start messing around with the data validation boxes.
The problem I am encountering now, is creating an exponential graph that will also keep changing as the user changes their selections in the data validation boxes. I am unsure if this is even possible, but I figured it was worth a shot to ask. On the example sheet, I have included a graph similar to the one I want, but it only contains data in a certain range of cells, rather than dynamically changing to accommodate whatever data is outputted.
Here is what I am looking for in the graph:
1. Whatever dates are selected by the user in the data validation boxes, along with the projected dates will be on the x-axis.
2. The PMPM figures associated with the selected dates, and the projected dates on the y-axis.
3. Ability to make different selections from the data validation boxes and still have a dynamic chart that keeps updating itself.
View 1 Replies
View Related
Dec 5, 2008
I have a worksheet with 500 rows. Coulmn A is all the dates of the items. Is it possible to somehow havea userform or something that I input a start date and a finish date and it only shows me that info.?
View 2 Replies
View Related
Jan 21, 2009
See the attached example. I have data listed as shown, but need the chart to automatically update whenever a new sales figure is added to the next month. I know you have to use the OFFSET to create dynamic ranges but I can't get it to work horizontally, only if my data is laid out vertically.
View 2 Replies
View Related
Aug 7, 2012
I am trying to create a bar chart that changes color based on a percentage range. Any advice on how to do this? I am using Excel 2007, Windows XP, Sharepoint 2010.
View 1 Replies
View Related
Feb 12, 2014
I have 6 columns. The 5th and 6th columns are the most important. The 5th contains a figure and the 6th contains a type.
Bascially I am trying to do a basic chart showing the following 2 things. A. Do a percentage chart of column 6 (service) but not of percentage of hoem many lines the product is in. Not based on percentage of how many times Apples are shown compared to other products. I need it to add up everything, then do a percentage of total amounts of oranges and total of for Apples from the figures on column 5. Also, if possible, the pie chart will even show teh actual total figure per product in each (or next to) each pie chart slice.
know the easiest way to do this (step by step) in Excel 2010 and then I can perhaps write a macro for the future?
View 1 Replies
View Related
Jan 24, 2012
I'm trying to create a macro to add a fill effect on the bars of my chart.
However, I don't want it to change the bar's current color. Just to do the effect on the current color.
Code:
Sub fill()
ActiveChart.SeriesCollection(2).Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlAutomatic
End With
[code].....
View 2 Replies
View Related
Jan 31, 2014
I have a data set where the rows contain monthly sales data (from January to December) and the columns contain the names of employees (joe, bob, sue, etc.) and a single "group average" column:
I would like to create a chart for each employee showing the employee's monthly sales vs. group average. For example, the first chart would be for joe...
Then the next chart will be for bob and so forth...
View 3 Replies
View Related
Sep 1, 2012
Trying to create a macro to run through the following steps when I select a chart and run the macro:
Paste>As Picture>Copy As Picture>As Shown When Printed>OK
I used the macro record feature and when I enter the shortcut it always returns the same chart. How do I get it to run on whatever chart I have selected instead?
I am constantly using this function to copy charts from Excel into PowerPoint presentations and am frustrated with all the extra steps it takes (versus just Ctrl-C).
View 9 Replies
View Related
May 28, 2008
I want to write a macro to add a surface chart for a Data Range which includes 6000 data points. But the series selected for the chart don't cover all Data Ranges, only part of them.
Public Sub AddChart2(LastRow As Integer, LastCol As Integer)
Dim cht As ChartObject, currentSheet As Worksheet
Dim rng As Range, newRow As Range, srcRange As Range
Dim colIdx As Integer
colIdx = 5
View 7 Replies
View Related
Apr 21, 2006
I have a chart with a series whose formula looks like this:
=SERIES("ACTUALS",BOD!$E$42:$AB$42,'OE2_EOM_Mar_06_(20APR_0900)_EDIT_THIS_ONE.xls'!BodOblActData,7)
The named range, BodOblActData, is a named range in the workbook, but how can I change the formula to use a named range in the work sheet?
View 3 Replies
View Related
Jun 11, 2014
I have a leave history report with data for leave taken for the 2014 year. The sheet contains the following headings:
Name; Leave Start Date; Leave End Date; Date Paid; Days Taken; Roundup; Offset
The roundup column rounds the days taken up, for example if someone took 0.4 days off it would round it to 1.The offset column just subtracts the Roundup value by 1 (=Roundup-1) I think we will need this for what I am trying to do.
I have created a new spreadsheet labelled gaant chart, this shows the name of the employee with the working dates for the year and has the following data:
Name
1/01/2014
2/01/2014
3/01/2014
6/01/2014
7/01/2014
8/01/2014
9/01/2014
10/01/2014
[code].....
What I would like for the macro to do is lookup Employee 1 from my gaant chart table and search the leave history data if it finds a relevant start date for the employee it marks that date with a 1, it then looks in the offset column and marks the number of offsets to the right. For example if employee 2 took leave from 1/1/14 to 3/1/14 the macro would mark a 1 on the 1/1/14, and search the offset column which would have 2, it will then mark a 1 in the 2 cells to the right of 1/1/14 also (these being 2/1/14 and 3/1/14)
View 1 Replies
View Related
Oct 11, 2006
I have been trying to create a macro in excel to chart a selection of data and to output the chart on the active sheet where the data was taken (as opposed to a named sheet). So basically, I have about 300 worksheets with data, and I would like to have a button on each page that automatically charts that data when clicked, and outputs the chart to the page where the macro was clicked. However, I have not been able to figure out a relative reference that will allow me to make the LocationasObject reference simply the ActiveSheet as opposed to a specifically named sheet. See my code below, which references an output to a worksheet called "Charts". Right now, all of my charts are outputting to the sheet called "Charts", as opposed to the active sheet.
Sub ConsDiscChart()
ActiveCell.Offset(29, 11).Range("A1").Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Selection.End(xlUp).Select
Selection.End(xlUp).Select
Selection.End(xlUp).Select
Selection.End(xlUp).Select
Selection.End(xlUp).Select
Selection.End(xlUp).Select
Selection.End(xlDown).Select
ActiveCell.Offset(0, 1).Range("A1:B1").Select
Range(Selection, Selection.End(xlDown)).Select
ActiveCell.Offset(0, -1).Range("A1:C24").Select
Charts.Add
ActiveChart.ChartType = xlLineMarkers
ActiveChart.Location Where:=xlLocationAsObject, Name:="Charts"
With ActiveChart
.HasTitle = False
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With
End Sub
View 5 Replies
View Related
Feb 20, 2014
I have a macro that using a list of values in a range, checks if there is a corresponding worksheet and if not, use the Template to create one, rename the worksheet and add the value into a cell.
I now have 2 types of template and based upon on the value in the range, I want it to create a worksheet using 'Template 1' for all values < 1000 and 'Template 2' for values > 1000.
Is it possible to amend my code for this?
HTML Code:
Sub CreateTimeline()
Dim rng As Range
Set rng = Application.Range("Projects[No.]")
[Code]....
View 2 Replies
View Related
Feb 3, 2014
.How do you create a popup windows which shows cells on another worksheet that you can change the values based upon a index / match or vlookup?
I select a cell that has a vaule of 102.
then Popups a box which matches that 102 range in another worksheet and shows pulldown (yes no). (Theres about 5 cells (side by side) of yes no pulldowns.
I want the user to then select the values they want and close the popup box.
User selects the following cell with 103. and then goes thru the same process.
View 3 Replies
View Related
Jun 2, 2009
I have a list of references in a range (A5:A98) in a worksheet called "Architectural". What I am trying to do is create a seperate worksheet based on each cell value in the range. However, rather than blank worksheets, I would like each new worksheet to be a copy of a worksheet called "Template". If possible, I would like to have the name of each worksheet also put into cell B2 of each copy.
View 2 Replies
View Related
Dec 21, 2011
I have file contains two worksheets. 1st worksheet named "list" and the 2nd one named "Template". I have a range in WS "List" let say a1:d20 that contains names. This range is not fix, it might be more or less. I need creating new worksheet using worksheet "Template" for the new sheets in the mentioned range as follow:
"Create new worksheet for each name in this range."
List is not unique, some names are duplicated. If the name repeated, create only one. Use worksheet template for each new worksheet created.
View 2 Replies
View Related
Feb 26, 2008
I need to create new worksheet with all the rows which has qty (column A) value of 1 and above by clicking on a submit button....
View 9 Replies
View Related
Dec 29, 2011
I have a spreadsheet created in Excel 2003 (which is what we use at work, unfortunately).
My employees periodically take a test to ensure they have certain items memorized (or are making progress to that end). The spreadsheet rows show all 46 of my employees, and their test scores. The columns are the dates that the tests are administered. I can create a line graph based on the chart data, and interpolate these data with no problems.
The problem is that there are 46 employees! 46 lines on the same graph make for a very cluttered, hard to understand visual. I want to simplify the view by "filtering out" some of the data.
I have an additional column in my spreadsheet for each employee's work area (Area 1, Area 2, etc), and another column with data based on first letter of last name (the values here could be "A-G", "H-M", "N-S" and "T-Z", for example). I figure i could filter my line graph based on these two columns. For example, somehow select just Area 1, and reduce the number of lines on the graph to 16. Or better yet, Choose "Area 2" AND "A-M" and end up with 7 employees (and therefore 7 lines on the graph).
Here's what i have tried:
1) Select the work area column, and use the Filter, which created a drop-down list at the column heading. When i use this drop-down list, i can easily filter the data in the worksheet by Work Area, but this is not reflected in the line graph, which still shows all 46 lines. The problem was that i forgot that i had set the Calculation Options to "Manual". Setting this to "Automatic" (or leaving it on Manual and pressing F9) solved the problem, as the chart now updates when i use the filters. Calculation options are under the "Formula" tab in 2007, or in Tools -> Options -> [either calculation or formula, i forget what it's called] in 2003.
2) Create several separate line graphs in several separate sheets. I wouldn't want to assign someone else the task of maintaining a spreadsheet of such inefficient design.
View 1 Replies
View Related
Feb 6, 2013
I have a userform with 17 checkboxes that their captions should correspond with column A range ("A2:A18) on a worksheet.
Is there a way in userform_initialize, or activate, to create the captions from that range?
I could type the code 17 times like;
Code:
me.checkbox1.caption = wb.worksheets("area").range("a2").value
I was curious to know if it could be looped? Textboxes on the same userform.
View 6 Replies
View Related
Oct 23, 2008
I need a macro to create the following worksheets and charts from an Excel data set:
Three (3) worksheets (already created manually in attached Excel file):
1. Chart Data.
(a) Column A in Chart Data is always numbered 1 - 600 (50 years x 12 mos/yr).
(b) Column I and column Y data sets (from Prod_Month) created in Chart Data. Each data set can be identified and collated with column F in Prod_Month (API) which is unique for each dataset.
2. Rate vs. Month - plot of Daily Gas (col. Y in Prod_Month) vs. Months (col. A in Chart Data).
3. Rate vs. Time - plot of Daily Gas (col. Y in Prod_Month) vs. Calender Time (col. B et. al. in Chart Data)
At a minimum, could someone help me create the Chart Data worksheet from the data in PROD_MONTH? Charting all the columns takes time from Chart Data but any data manipulation macro(s) help.
View 14 Replies
View Related
Oct 28, 2009
Im trying to create a document that creates a new workbook when certain functions are selected and have written a macro to assist with this. Basically im working on a comprehensive checklist with all possible scenarios that will need to be tailored for use, so you can create a document with just what is applicable to you and not the whole checklist. I have attached a sample of what i mean, along with clearer descriptors of what the document is designed to do.
View 5 Replies
View Related
Aug 25, 2009
I tried recording a macro to add to a new worksheet, but it gives error while running.
Issue as I understand is, by default excel gives a new worksheet a name (Say Sheet 4), and when u run macro worksheet, new created name may be different.
View 7 Replies
View Related
Oct 3, 2012
I need to have many users press a button within the excel sheet that duplicates the form from the current page, opening a new tab (copying the form) that also prompts to input a specific name e.g. "Enter date and day or night shift" to name the tab itself.
I have just worked out how to put a Command Button in and used the above code to create the new page assigning the code to it.
I need the "my sheet" to be prompted and customisable.
View 3 Replies
View Related
Feb 6, 2014
I need to create a Worksheet within a macro that has 10 tabs. I had something running, then I made some changes and I got Application-defined or object defined error.
Sheets("Sheet1").Name=Sheetname(1)
Sheets.Add after:=Sheets(Sheets.Count)
I was looping thru this up to 10 now its not working. This isn't too complicated,
View 9 Replies
View Related
Mar 9, 2007
I would like to create the clock function.
This is my function name. - Clock()
If i put this function in Cell A1. Then from now onwards cell A1 will display system current time. It will keep showing the every seconds changes.
And clock will run itself independenly.
View 3 Replies
View Related
Jun 16, 2008
Is it possible to use a macro to create a new worksheet with a button on it, that has a macro attached to it, that i can send out to people? I've looked at the Template example, but i'm not sure this will work when emailed as i'm unsure whether the template will be sent to them.
View 3 Replies
View Related
Oct 15, 2012
Iam looking for macro to copy rows based on partial cell content of a column. I have an excel spreadsheet called "arc.xlsx" from which I would like to copy data to other few new excel files when certain criteria are met. The excel file contained location is C:Documents and SettingsxxxxDesktopCompany.
Below is a sample of arc.xlsx
GP CUST_NO BR CUST_NAME day mo year
I1 999999 1 SMITH 0 8 9
I1 999999 ab SMITH 4 8 9
I1 999999 cd SMITH 4 10 9
I1 999999 1 SMITH 4 1 10
[Code]...
I would like the macro to copy rows that have 'ab' in the column c (with title BR)and save it in a new excel file with name ab.xlsx in the same location folder.And the same for 'cd', '01' and '02' by saving the data in files with name cd.xlsx, 01.xlsx so on.
View 3 Replies
View Related
Oct 25, 2008
I have code that creates a textbox on a worksheet, copies the contents of a cell from another worksheet to that textbox. I want to be able to select that text and format its appearence ( center the text, bold and font style and size). This is what I have so far but I do not know how to select the text that was imported.
Sub textmove()
Dim bname As String
Sheets("cover").Shapes.AddTextbox(msoTextOrientationHorizontal, 96.75, 512.25, _
230.25, 120#).Name = "client"
bname = Sheets("data").Range("a3").Value
Sheets("cover").Shapes("client").TextFrame.Characters.Text = bname
With Selection.Characters(Start:=1, Length:=17).Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
End Sub
View 10 Replies
View Related