excel

How can I run a Perl script through an ActiveX Control within Excel?

I want to run a Perl script at the click of a button inside an Excel spreadsheet. As the button is assigned to execute a VB macro, the macro should effectively execute the program. As my first ever VB script, this is what I came up with, which throws up an irritating Run-time error '424': Object required error. Sub RunPerlScript() ...

Counting the frequency of an event

Hi, I have a string of stock price data data and I want to be able to count how many days the price moves up or down lasted. So for example, from the data I have a used "if" functions to determine if a day was up or down: "U" for and Up day and "D" for a Down day. Lets say the string then looks like this: UUUDDUDUDUDUUU I want a for...

Creating an Excel Sheet with ADO.NET (OleDb) --> What DataTypes are Supported?

Hi I try to create an Excel (2003) Sheet with ADO.NET (OleDb). I was able to create the Sheet with an OleDbCommand: var cnnString = "Provider=Microsoft.Jet.OLEDB.4.0;..."; var cnn = new OleDbConnection(cnnString); var cmd = cnn.CreateCommand(); cnn.Open(); cmd.CommandText = "CREATE TABLE MySheet (ID char(255), Field1 char(255))"; cmd....

Excel: Create a new sheet for each row

In an excel sheet, I have roughly 30 rows x 100 columns of data. Each row represents a different "client". For each client, I've create a summary sheet that is emailed to them and that also contains all the information from my main sheet My question is as follows, is there a way for excel to create a new sheet based on some template she...

Excel VBA - Insert a Row to a Specific Set of Columns

Hi all, I'm working on a spreadsheet to act as a master copy for some important information that will be kept track of for a project. On the main sheet I have a table for notes and a table for contacts set up seperated by several columns and some VB code to insert new notes or new contacts. However, when I insert a new note I want it to...

Find Text Cells That Are Too Small to Display Contents

I have a worksheet with cells that may contain text that sometimes exceeds the width and height of the cell. If I don't notice it and adjust the row height, the text shows up as cutoff. Does anyone have a VBA snippet or tool that can locate these cells so I can adjust them? Thanks! ...

Excel Forms Edit Only

I have this excel sheets + a vba part with 3 forms that interacts with the sheets (read/write data, xml export, etc). I have some data verification in my forms' code, so I would like to be able to modify values in the sheet only through the forms, not through direct "on-the-sheet" editing Is that possible? When I lock the cells I want ...

Using XDocument to write raw XML

I'm trying to create a spreadsheet in XML Spreadsheet 2003 format (so Excel can read it). I'm writing out the document using the XDocument class, and I need to get a newline in the body of one of the <Cell> tags. Excel, when it reads and writes, requires the files to have the literal string &#10; embedded in the string to correctly sho...

Excel VBA: force refresh of "last" cell of the worksheet

Pressing Ctrl+End in Excel takes you to the bottom-right-most cell of the worksheet. If you delete the last rows or columns and save the workbook, this last cell gets updated (and the scroll bars do to). I remember there was a one line vba command that you could run that would do the update without having to save the workbook, but I ca...

How to avoid Excel localizing object names and breaking macros?

I have this line of code in my macro: ActiveSheet.ChartObjects("Chart 6").Activate When I open the file and run the macro on a non-English version of Excel, this code breaks. For example on the Japanese system I tested it on, I would need to change the previous line to: ActiveSheet.ChartObjects("グラフ 6").Activate (グラフ means Chart in...

Help with Excel VBScript - fill columns with data

Hi all, I have a spreadsheet with email addresses (column A) I need to write a macro/VBScript function to fill columns B to L with numbers 1 to 11 respectively i.e. [email protected] 1 2 3 4 5 6 7 8 9 10 11 Could someone help me achieve this please? TIA. ...

excel - how to duplicate each row with a macro

I have excel sheet with N+1 rows where Column A has unique id N. I need to duplicate each row so that below a row N there will be three new rows with unique-ids N-b, N-c, N-d e.g. sample input rows: id1 data here id2 data2 here e.g. sample output: id1 data here id1-b data here id1-c data here id1-d data here id2 ...

Create a chart in Excel using C#

Hi Everyone, I'm having some trouble creating charts in Excel with C#. I've managed to get a chart of any kind working with the following code: Excel.Range chartRange; Excel.ChartObjects xlCharts = (Excel.ChartObjects)xlWorkSheet.ChartObjects(Type.Missing); Excel.ChartObject myChart = (Excel.ChartOb...

Amending Excel Pivot Table Criteria Programatically

I have an Excel spreadsheet template. It contains pivot tables having criteria that specify the content of the spreadsheet. I need to amend that criteria programatically from a macro running in a separate spreadsheet so that the template will feature different content. What coding would be appropriate to achieve this ...

Performance issue with accessing Microsoft.Office.Core.DocumentProperties

Hi, I have a Excel COM addin which reads the CustomDocumentProperties section of a workbook. This is how I access a particular entry from the CustomDocumentProperties section DocumentProperties docProperties = (DocumentProperties) xlWorkbook.CustomDocumentProperties; docProperty = docProperties[propNam...

Excel: getting the selected rows back

I'm using Microsoft.Office.Interop.Excel, and I can't find a way to return the selected rows. What I mean by "selected" is, the row numbers themselves when you click on the row gutter on the left and select one or more contiguous or non-contiguous rows (which highlights the whole row.) This is different from selecting a region or area ...

Changing Row Height in Excel after Rendering by ASP.Net SSRS ReportViewer

I have an SSRS report that has a Comments field where there's enough text to span multiple rows per record. It renders fine in the ASP.Net ReportViewer control, but when it's exported the formatting can be different. Exporting to Word it looks fantastic. But exporting to Excel and PDF, the row height for each record is never increased...

How to reassign the address of a named range in Open Office VBA?

In Excel VBA, I redefine the address of a named range with: Ranges("MyRange").Cells(1).CurrentRegion.Name = "MyRange" in the Worksheet_Deactivate event. This way, after updating the spreadsheet, MyDataRange always references to the entire data. Ok with Excel, but when I tried to migrate this to Open Office VBA (OpenOffice.org 3.1.1 /...

Excel - Open Multiple Windows and Tile on Sheet Tab Click

Hi, I'm trying to write a macro and I have the 2nd half done (tile windows showing specific sheets) but not sure how to do the first half. There are some sheets that when displayed I would like to look at two other sheets at the same time (multiple window tiling). This is easy to set up manually, but I'd like it to happen automaticall...

Excel - Worksheet_Activate Code for New Sheets

Hi, I have three questions about VBA and controlling/manipulating new windows. I have several sheets set up. Master | Worksheet1 | Worksheet2 | Notes | Work Orders | Contact Info 1) I have WorkSheet_Activate functions set up on Notes, Work Orders, Contact Info that open up all three sheets in seperate windows and arrange them vert...