excel-2010

PivotTable Do not show subtotals

江枫思渺然 提交于 2019-12-04 15:57:26
I am converting a table into Pivot and then to a CSV file. I want to remove the subtotals of the pivot table. So far: this is my progress. MACRO CreatePivot: Sub CreatePivot() ' Creates a PivotTable report from the table on Sheet1 ' by using the PivotTableWizard method with the PivotFields ' method to specify the fields in the PivotTable. Dim objTable As PivotTable, objField As PivotField ' Select the sheet and first cell of the table that contains the data. ActiveWorkbook.Sheets("Employees").Select Range("A1").Select ' Create the PivotTable object based on the Employee data on Sheet1. Set

Cell Value Change Event and Running a Continuous Macro

纵然是瞬间 提交于 2019-12-04 15:29:23
I want my macro to run automatically when Sheet1 is open AND a value is changed in any of the drop down menus in Column B. I assume I can write a couple of event listener wrappers such as: ' pseudocode While Sheet1 is open When a dropdown value is changed in column B Call Update End When End While I've found a few links online, but I don't quite understand. In these links, they have code referring to Target. Is Target a named range? I haven't had any luck implementing these. I'm thinking these links could have an answer to my problem. http://www.mrexcel.com/forum/excel-questions/95341-running

Copying an array to a filtered range gives irrational results

浪子不回头ぞ 提交于 2019-12-04 14:55:41
Copying the values of a filtered range to an array seems to work without a problem: the array then contains values from both filtered and unfiltered cells. However, when I copy the array's contents back to the filtered range, the results are incomprehensible to me. Here's my code: Sub test() Dim rangecopy() As Variant rangecopy() = Range(Cells(2, 1), Cells(14, 3)).Value For c = LBound(rangecopy, 1) To UBound(rangecopy, 1) rangecopy(c, 1) = c rangecopy(c, 2) = c * 10 rangecopy(c, 3) = c * 100 Next Range(Cells(2, 1), Cells(14, 3)).Value = rangecopy() End Sub It is supposed to give the following

Sum() Across Dynamic Number of Sheets

青春壹個敷衍的年華 提交于 2019-12-04 14:52:18
Hello all and thanks for your help ahead of time, I have an excel sheet that is solely to take the summation of multiple sheets. Best and most simply put, the formula is something like =sum(Sheet1!A1,Sheet2!A1,Sheet3!A1,Sheet4!A1) . There are a few issues that complicate matters though. First off all, I do not know the number or order of the sheets to sum, nor do I know their name. This formula will be copied into ~150 other cells, so I need the summation to be dynamic instead of physically adding sheets to ~150 cells every time. (Also the configuration and naming of the sheet does not allow

Excel 2010 - Storing Ribbon Customization in Workbook

蓝咒 提交于 2019-12-04 14:48:44
I'm new to Excel ribbon customization. What is the most straight forward way to store ribbon customization inside a workbook, so that when the workbook is closed the customization disappears without a trace? JMax To change the ribbon with a workbook, you need to change the XML file "inside" the xlsx file (which is nothing more but a .zip). Everything is very well explained here: http://www.rondebruin.nl/ribbon.htm Please let us know if that does not answer your question. sirplus The most straightforward way is to right-click on the ribbon & choose customise ribbon, then look on the lower right

VBA code to add a basic ribbon in Excel 2010?

一世执手 提交于 2019-12-04 14:26:41
I have used products to write ribbons for Excel in C# (addin express) but I need to know how to produce a ribbon using vba. Would someone be able to provide me with some code that inserts an additional ribbon into the toolbar for this? By ribbon I mean where it says "Formulas", "Data", "Review" etc Olle Sjögren You can customize the ribbon in Excel using a combination of XML and VBA. A good starting-point for customizing the ribbon: http://msdn.microsoft.com/en-us/library/office/aa338202%28v=office.12%29.aspx (The title says Office 2007 but it will work for Office 2010 as well) Another good

Excel VBA runtime error 1004 only with names that begin with 'c'

旧巷老猫 提交于 2019-12-04 14:07:12
That's right. If I change the 'C' in 'Chart_Series_W_Gain_AAPL' in the following code to any other letter the code works. Otherwise it throws an Error 1004 at the Series.Formula assignment. In fact, if I use any random name that begins with 'c' the code fails but not otherwise. I've tried closing Excel and reopening, but same issue. I came across this because I had been naming my chart series defined names beginning with the name of the chart, but then I decided that was confusing and I attempted to prepend defined name used as a chart series with "Chart_Series_". Pretty benign change, one

VBA recognizing workbook by partial name

*爱你&永不变心* 提交于 2019-12-04 13:24:11
Is there a way to specify a workbook for a sheet without having the full name? For example, If the workbook name is MyWorbook2015 and the 2015 may change to 2016 in the future, I need to to recognize the workbook based on MyWorkbook, and ignore the 2015. Something similar to this: With Workbooks("MyWorkbook2015").Sheets("My_Sheet_Name_That_Does_Not_Change") 'do something End With In the code sample above, I need it to recognize the work book regardless of the date? Is this possible? If it is, how would I go about doing that? Yes you can use the LIKE Operator with a wildcard "*". Here is an

Insert into Access Select from Excel from within Access VBA

核能气质少年 提交于 2019-12-04 12:59:05
I have an Access 2010 database with all tables linked to SQL Server 2014 tables. I have an Excel 2010 (.xlsx) file (though it starts as a .csv, and I could leave it that way), that I need to import into a SQL Server table via VBA code. I know that there are import tools available to do this, however, I have 20+ XLS files per month to import, and would rather have an automated method of doing this. All my VBA code resides in the Access database, and all the examples of VBA code I've been able to find are for pushing data from Excel (i.e. the code is in Excel) not pulling from Access (i.e. the

Iterating through Excel sheets

左心房为你撑大大i 提交于 2019-12-04 12:06:06
Here is my code. I'm new to VBA so, I am unsure how to iterate through multiple pages. Here's my code: Dim ws As Worksheet Sub spellCheck() For Each ws In ActiveWorkbook.Worksheets Cells.CheckSpelling Next End Sub Try this (this will simply activate each sheet): Sub spellCheck() Dim ws As Worksheet For Each ws In ActiveWorkbook.Worksheets ws.Activate ' Do stuff... Next End Sub 来源: https://stackoverflow.com/questions/12060855/iterating-through-excel-sheets