excel

How do I Increase cell value in Excel using VBA? Error: Type mismatch

I'm writing a macro, but because I'm working for first time in vb, I faced problems. My code: Cells (1, 1).Select Dim tempvar As Integer tempvar = Val(Selection.Value) // error Selection.Value = tempvar + 1 What my code should be: Cells(1,1).Value+=1 I get error "type mismatch". How do I accomplish that? EDIT: Row 1, Cell 1 is me...

What is correct content-type for excel files?

I want excel files on a website to open in Excel when clicked, not get saved on desktop, or get opened embedded in a browser etc. Now obviously it all depends on how everything is configured for each user, but what's the best Content-Type and other settings to achieve just that most of the time? ...

Looping through worksheets in an Excel (xls) file using classic ASP on a win 2008 server

Hi, I have just migrated an older ASP solution to a windows 2008 server and everything works out fine except for using ADOX.Catalog to list all the worksheets in an uploaded xls file. I use the following code: <% Set objExcelCon = Server.CreateObject("ADODB.Connection") With objExcelCon .Provider = "Microsoft.ACE.OLEDB.12.0" .Conne...

Excel::Shape object getting released automatically after the count reaches 18 in List<T>

I have a Excel addin written in C# 2.0 in which I am experiencing a strange behavior.Please note that this behavior is only seen in Excel 2003 and NOT in Excel 2007 or 2010. Issue: When the user clicks an import command button, a file is read and a number of Shapes are created/added to the worksheet using Worksheet::Shapes::AddPicture(...

How can i seperate the first and last name of a cell?

If A1 is [Jones,Mike], how can I get it to seperate but still use the first name as text in the other cell? Yes, text to columns would work greatly, but it does let me use the first name in a formula. ...

Export to Excel from ASP.NET produces files unreadable with Excel Viewer

Hi, I want to output some dynamic data from an ASP.NET website to Excel. I found that the easiest way which does not require to use Excel XML or to install Excel on server machine is to output data as a table and specify application/vnd.ms-excel type. The problem is when I do so and try to open the file in Excel Viewer, I receive the f...

how to set equal width for all cells in excel sheet using vba

hi , i am popualte the data from MS access To Excel Using VBA during the population excel sheet it automatically set random width for thier cells. it is possible to set width equally for all cells using VBA thanks in advance ...

how to insert formula in excel using vba

How to insert the formula for the entire column using vba ...

deep linking in Excel sheets exported to html

hello everybody, I am working on a project where I must export to html a lot of Excel files. This is pretty straightforward using automation and saving as html. The problem is that many of these sheets have links to worksheets of some other files. I must find a way to write a link to a single inner worksheet. When you export a multi...

Excel string manipulation to check data consistency

Background information: - There are nearly 7000 individuals and there is data about their performances in one, two or three tests. Every individual has taken the 1st test (let's call it Test M). Some of those who have taken Test M have also taken Test I, and some of those who have taken Test I have also taken Test B. For the first two ...

How to delete VB code from an Excel sheet using C#?

Does anyone know how to delete all VB code form an Excel workbook using C#? This code doesn’t work. It removes first (last one) VBComponent, but rises ArgumentException on second one. VBProject project = workbook.VBProject; int componentsCount = project.VBComponents.Count; for (int i = componentsCount; i >= 1; ...

reading excel data.

How to read Excel data having Number format ;;; ie hidden value in C# using spreadsheet gear. ...

Pull in Earlier Value Using Concatenation

I have code that works in some situations but not in others. I have this code: Public Sub ListBox2_LostFocus() ListBox2.Height = 15 With ListBox2 ThisIs_Sheet1_Test = "'" For i = 0 To .ListCount - 1 If .Selected(i) Then ThisIS_Sheet1_Test = ThisIs_Sheet1_Test & .List(i) & "','" End If Next i End W...

OleDBDataAdapter UNPIVOT Query not working with Microsoft.ACE.OLEDB.12.0 DataSource

I am reading in an excel file with an OleDBDataAdapter. I am using a select statement to UNPIVOT the data and insert into DataSet. However, the compiler is genereating this error: {"Syntax error in FROM clause."} But the SQL Statement is correct as I have used it in other DB's Here is the code: string strConn = "Provider=Microsoft.A...

How to copy from C# control and paste link into excel.

I have an application that I want to link to excel. I have no preference which control is used as long as I can copy the data or control, and paste link into excel. When the data changes in my application, I want the cell to change in excel. I have a client that claims it is possible and he has seen it, but has no proof and may be con...

Column variables in Excel?

Let's say I have column A and Column B. Cells in Column A contain either "Y" or "N". How can I set the value of the cell in the corresponding row in Column B with a formula that detects if the cell's value = "N"? Not new to programming logic but to Excel formulas, thanks for your help. -Ryan ...

Crystal report export to Excel with wrong page size

I have designed the report in A4 size, When I export to PDF, the size fit well. However, when I export the report to Excel 2000/2003, the report cannot fit in a page. Could anyone tell me how to fix it ? Thanks ...

Excel2k7/VBA:getting the cell address when a form button is clicked in it

Hello All, I've multiple form buttons in multiple cells and when clicked any one of them, i've to perform a function. Now i need to know which cell has this clicked button so that i can take next steps. Thanks in advance ...

Export with VB to Excel and update file

Hello. This is the code that i have to export data to Excel. Dim oExcel As Object Dim oBook As Object Dim oSheet As Object oExcel = CreateObject("Excel.Application") oBook = oExcel.Workbooks.Add oSheet = oBook.Worksheets(1) oSheet.Range("A1").Value = "ID" oSheet.Range("B1").Value = " Nome" oSheet.Range("A1:B1").Font.Bold = True oShee...

Excel Spreadsheet - Best way to perform an Oracle Query on a cell

Hi there, I have an Excel Spreadsheeet. There is a cell containing a concatenated name and surname (don't ask why), for example: Cell A2 BLOGGSJOE On this cell, I would like to run the following SQL and output it to cell A3, A4 and A5 SELECT i.id, i.forename, i.surname FROM individual i WHERE UPPER(REPLACE('" & A2 & "', ' ', '')) =...