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...
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?
...
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...
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(...
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.
...
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...
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 the formula for the entire column using vba
...
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...
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 ...
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; ...
How to read Excel data having Number format ;;; ie hidden value in C# using spreadsheet gear.
...
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...
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...
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...
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
...
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
...
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
...
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...
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 & "', ' ', '')) =...