I am exploring yet another avenue of vba coding that i am not familiar with.
I have a template word document that i am wanting to fill with items (be it cell values or charts) from an excel file.
I am looking at the coding examples on the net and i am slowly getting there. However i seem to be unable to copy a chart from my excel file and copy into word. I need to be able to specify a specific position on the word document too.
When i add a month coloumn,Sparklines and Average coloumn should get updated automaticaly.Now this is not happening even if the data is in table format.I also want the graphs to be automaticaly updated.
I have an excel program that is supposed to count word instances in a word document. I can't seem to find the right declaration for a word document. For example to declare a workbook in excel its
Dim wb As Work Book
I've tried
Dim doc As Word.Document 'or Dim doc As Word.Application
as shown in some of the forum posts, but an error user-type not defined keeps displaying.
I am trying to put some charts into a report that is pivot table based. I have some code that will work if the pivot tables stay stagnic but the users may change the tables around so that could be an issue of new data. I have the following code where I changed the source to the pivot table name (general name because of numberous report possibilites). I have taken out the other charts because they are just a variation of the chart 1. I am crashing on the line with the * on it.
Sub UWTierChart() Dim oCell As Range Dim oChart As Chart Set ws_data = ActiveSheet 'Chart 1 Sheets(wsPT).Select Range("B21").Select
Is it possible to export Excel cell contents to Word fields in a protected Word document? For example...
What code would be needed to tell Excel to open up, copy and export the contents of A2 in the active sheet of a workbook to "Field 2" in a Word document named "Report 01" and then put the contents of B2 to "Field 2" etc?
Do both applications have to be opened up at the same time or is Excel able to open up Word on its own? Will the macro be able to....
1. Automatically open up the correct Word document?
2. Look ONLY in a certain folder for the "Report 01" Word document?
or
Bring up a "selection" box that allows you to select the document you wish Excel to export it's data to?
3. Close and save the Word Document without any user intervention?
I need to count how many times the word Test is in the range B4:H9 with
Range N2 = Test the formula below works if Test is only in the cell once.
=COUNTIF($B$4:$H$9,"*" & N2 & "*")
But I have data in cells like below, this is all in one cell, so how would I have it count all the times test is in the range when some cells have test 2 or more times in a single cell?
I need my macros to search for the word "Cancel" or "Cancelled" in columns "T" and "U". Once found, I need the macros to make that entire row an opaque shading.
There will be other wording in these cells that contain "Cancel" or "Cancelled". Is it possible for the macros to search in the sentence and find the words "Cancel" or "Cancelled"
1. I have a excel file with Japanese words in column A and their English equivalents in column B.
2. I am trying to create a Macro and assign it to a button. On pressing the button Macro should be able to:
3. open a form where I can enter location of a word file.
4. Macro should open the word file specified in (3).
5. Macro will pick up first Japanese word from excel file (Sheet 1 - A1)
6. Search for that word in Word file
7. Replace the Japanese words in Word file with their English equivalent from excel (B1)
8. Then it should search for second word (A2) and replace with its equivalent (B2) and so on till it reaches last filled cell in excel file column A.
After a lot of search I could find a code from net (Below), made a few changes, but it is not working.
======================================================== Private Sub OK_Click() ' Requires a reference to Microsoft Word xx.x Object Library Dim sFile As String
I am in the middle of automating a process here at work, the program takes a word, "pencil" for example, from excel. It will then open up a word document with content already in it (premade template). The program will then find all instances of a string, "placepencilhere" for example, and will replace that instance with the string from excel.
Basically I want to be able to take a variable that has a stored string value from excel and use it to replace another variable in a word document.
I tried recording a replace (ctrl+f, replace tab) macro, copying the code, and inserting it into the excel vba code.. but I get a error message. Here is what I have:
I have a bunch of cells in column b that have products.
Column B Dell 24" lcd vaio sony laptop 8.0 mpxl kodak camera photoepsonprinter
Basically in Column A I want a formula that'll say.
If the word "dell" is somewhere in cell b1, then put the word "Dell" in cell a1. If the word "sony" is somewhere in cell b1, then put the word "sony" in cell a1.
And then so on and so forth down through column A. The brand names are potentially endless, so is there a easy way to on like a seperate sheet make a list of brand names and have it pull from there?
Originally I made a if function that said if the brand name was contained in the cell then output the brand name, but that caps at 7 for the amount of brands i can use....
I have never done this before and I am having a hard time - it seems that none of the graphs in the Excel menu accommodate what I want and I have no idea what I am doing to boot.. Could someone PLEASE help?
My data is: American & Japanese workers can each produce 4 cars a year. An American worker can produce 10 tons of grain a yr. / Japanese 5 tons of grain a yr. Each country has 100 million workers.
Need PPF and Opportunity cost of car & grain from U.S and Japan.
I have at this for two days and I cannot get the information in the chart the way it is supposed to be. It makes no sense evry way I have tried it and the graphs don't even look correct. I've tried several line graphs and scatter graphs..
I update graphs/charts everyday. I've been looking at ways of updating a lot of charts in 1 action.....
What would the formula be to have the range of the chart (ie =Data!$BS$1188:$BS$1201) to get the row numbers, not the row, from numbers entered elsewhere on a data sheet (ie =Data!$BS$1188:$BS$1201)
As a lot of the time I use the same number range but on different rows and sheets.
I'm trying to find a way to select all charts in a worksheet and pasting them into a new sheet as a jpeg and can't find a way to select the charts all together as a group like if you shift click them.
I'm looking to copy and paste them as a group because they are grouped in a specific way for a report.
I have 2 charts on one sheet. Both the charts are generated using 2 different VBA code. I have also created a Button to trigger the code and generate chart when the button is clicked.
I recently realized that I was creating charts upon charts and was making the excel file bigger in size all the time.
So, I wanted to see if I can delete the individual chart before generating a new one.
Currently, I am using the following code to delete the charts.
I am having lots of issues with generating a scatter chart in vba. I tried recording a macro but the only thing that recorded was my different selection clicks on the chart. No formatting was recorded. I have the following ....
I have a piece of code that arranges a chart to fit the data it should show. The code used to work perfectly in the old Excel version, but after an "upgrade" to Excel 2007 I get "Automation Error" from the line where the scale type is set.
I have a spreadsheet that calculates a value for each age up to 65 on a separate row. I have parameterized the spreadsheet so that depending on the age entered by the user, any row below the age 65 calculation row is blanked out (set to "") with an if statement.
After a new age is entered I would like a line graph to compare the values. My problem is that if I select all of the possible data values (I assume none are less than 20, therefore there are 45 rows of formulas) any rows that have blank values show up in the chart. My data starts in cell A1.
I would like to come up with a macro that accomplishes the following . . .
- determines the number of the lowest row that has a number value in it (since there are formulas below this, Ctrl down does not do this correctly)
- set a named range starting from cell A1 based on x rows (calculated in the prior step) and y rows (constant)
I've got a table which has additives in Column A and products on Row 1. There are 13 additives and 10 products. Each combination of product and additive has a price. So I have 130 different prices in my table. The prices change monthly and the new prices are added to the sheet so that last months prices will move to left so that the newest price data table is A1:J13 and previous month is K1:T13 and so on.
I need to make an individual chart to every combination which contains the history of the price changes. I have two cells (A20 and B20) where the user can pick a product and an additive (created a menu by using Data|Validation...). These selections are combined in a cell C20 (=A20&B20). Then I have a macro that is linked to the cell C20 and is basically Case Is = 1st combination --> Call Macro1, Case Is = 2nd combination --> Call Macro2 etc.
That macro will work out just fine, BUT is there any way I could make all the 130 charts easier? Now I've recorded a macro that creates the first chart and then I've just copy-pasted it, changed the attributes (cell numbers, names and so on) that define the data to the next charts. This will take ages...
Every combination will have at least 13 changes (12 monthly price cells and the name of the cart) so in total this will mean about 1500 manual changes. In my case this will mean a high danger of typos.
I know, it would be SO much easier if I could give you the Excel file to look at...hopefully you understood what I mean.
I'll only follow the changes within a year so prices older than a year will not be shown in the charts.
Now I need to create multiple pie charts based on data in tables on many sheets.
I need to create the same set of charts, for each sheet separately.
I recorded a macro for one sheet, which created following
ActiveSheet.Shapes.AddChart.Select ActiveChart.ChartType = xlPie ActiveChart.SeriesCollection.NewSeries ActiveChart.SeriesCollection(1).Name = "='GALLERY ON 4TH'!$B$2" ActiveChart.SeriesCollection(1).Values = "='GALLERY ON 4TH'!$D$6:$D$8" ActiveChart.SeriesCollection(1).XValues = "='GALLERY ON 4TH'!$A$6:$A$8" Range("A11").Select ActiveSheet.Shapes.AddChart.Select ActiveChart.ChartType = xlPie ActiveChart.SeriesCollection.NewSeries ActiveChart.SeriesCollection(1).Name = "='GALLERY ON 4TH'!$A$6" ActiveChart.SeriesCollection(1).Values = "='GALLERY ON 4TH'!$B$6:$C$6" ActiveChart.SeriesCollection(1).XValues = "='GALLERY ON 4TH'!$B$5:$C$5" ActiveWindow.SmallScroll Down:=3 Range("A11").Select ActiveSheet.Shapes.AddChart.Select ActiveChart.ChartType = xlPie ActiveChart.SeriesCollection.NewSeries ActiveChart.SeriesCollection(1).Name = "='GALLERY ON 4TH'!$A$7" ActiveChart.SeriesCollection(1).Values = "='GALLERY ON 4TH'!$B$7:$C$7" ActiveChart.SeriesCollection(1).XValues = "='GALLERY ON 4TH'!$B$5:$C$5"
However I cannot automate. I tried different methods for creating the charts, as found on the site [prefer .chartobjects.add(x,y,z,a) since I can immediately position the chart] , but get stuck at seriescollection everytime.
It looks like when the chart is created by XL (with suggested data in it) I cannot address the series data. I got it right to generate a chartobject that is empty, then added the series data to it, but when opening the new chartobject, it is again populated with suggested data.
How do I generate an empty chartobject everytime, so I can insert seriescollection info with code?
I used a "MID" formula to extract some data and for some reason the chart I'm trying to use won't recognize the data. Here is a copy of what the data looks like. Non of the vaules will show up on the chart. DPJE2DD2CE2CJan1.2784.8984.8997.65Feb1.2697.6597.6591.79B10==MID(B$3,8,5)Mar1.3091.7991.79154.7Apr1.28154.7154.7147.6May1.29147.6147.687.78Jun1.4387.7887.78112.6Jul1.39112.6112.6115.2Aug1.42115.2115.293.6 Sep1.3393.6 93.6 138.9Oct1.28138.9138.9NovDec115.6YTD1.32115.6115.6
i am trying to add 50 new data series and it takes hell of a lot of time to do it manually.
Sub Macro6() Dim total As Integer Dim Taper As Integer Taper = 2 Do Until total < 100 total = total + 1 Taper = Taper + 1 ActiveSheet.ChartObjects(" Chart 3").Activate ActiveChart.PlotArea.Select ActiveChart.ChartType = xlBubble ActiveChart.SeriesCollection.NewSeries ActiveChart.SeriesCollection("Total").XValues = "=Data!R" & Taper & "C6" ActiveChart.SeriesCollection("Total").Values = "=Data!R" & Taper & "C8" ActiveChart.SeriesCollection("Total"). Name = "=Data!R" & Taper & "C9" ActiveChart.SeriesCollection("Total").BubbleSizes = "=Data!R" & Taper & "C7" Loop End Sub
I have lots of charts in a sheet "plots" which is based on data in sheet "data Summary". Sheet "plots" have the following code, which is based on the event "actiavte". At the end my main macro, I am activating sheet "plots" and all the charts are working fine. After this if I go to any other sheet in the workbook and come back to "plots", all the charts are flickering and the cursor turns to busy mode. I don't understnad why this is happening.
Private Sub Worksheet_Activate() For Each ChtOb In ActiveSheet.ChartObjects ChtOb.Chart.PlotVisibleOnly = False Next ThisWorkbook.Worksheets("plots"). Range("e1").Activate On Error GoTo Handle With ActiveSheet.ChartObjects("s21max").Chart.Axes(xlCategory, xlSecondary) .MinimumScale = Application.Average([s21high]) + -4 * Application.StDev([s21high]) .MaximumScale = Application.Average([s21high]) + 4 * Application.StDev([s21high]) + Application.StDev([s21high]) * 0.25 .CrossesAt = .MinimumScale..........................