Search Results

Search found 4783 results on 192 pages for 'excel vba'.

Page 104/192 | < Previous Page | 100 101 102 103 104 105 106 107 108 109 110 111  | Next Page >

  • How can I remove rows with unique values? As in only keeping rows with duplicate values?

    - by user1456405
    Here's the conundrum, I'm a complete and utter noob when it comes to programming. I understand the basics, but am still learning javascript. I have a spreadsheet of surveys, in which I need to see how particular users have varied over time. As such, I need to disregard all rows with unique values in a particular column. The data looks like this: Response Date Response_ID Account_ID Q.1 10/20/2011 12:03:43 PM 23655956 1168161 8 10/20/2011 03:52:57 PM 23660161 1168152 0 10/21/2011 10:55:54 AM 23672903 1166121 7 10/23/2011 04:28:16 PM 23694471 1144756 9 10/25/2011 06:30:52 AM 23732674 1167449 7 10/25/2011 07:52:28 AM 23734597 1087618 5 I've found a way to do so in VBA, which sucks as I have to use excel, per below: Sub Del_Unique() Application.ScreenUpdating = False Columns("B:B").Insert Shift:=xlToRight Columns("A:A").Copy Destination:=Columns("B:B") i = Application.CountIf(Range("A:A"), "<>") + 50 If i > 65536 Then i = 65536 Do If Application.CountIf(Range("B:B"), Range("A" & i)) = 1 Then Rows(i).Delete End If i = i - 1 Loop Until i = 0 Columns("B:B").Delete Application.ScreenUpdating = True End Sub But that requires mucking about. I'd really like to do it in Google Spreadsheets with a script that won't have to be changed. Closest I can get is retrieving all duplicate user ids from the range, but can't associate that with the row. That code follows: function findDuplicatesInSelection() { var activeRange = SpreadsheetApp.getActiveRange(); var values = activeRange.getValues(); // values that appear at least once var once = {}; // values that appear at least twice var twice = {}; // values that appear at least twice, stored in a pretty fashion! var final = []; for (var i = 0; i < values.length; i++) { var inner = values[i]; for (var j = 0; j < inner.length; j++) { var cell = inner[j]; if (cell == "") continue; if (once.hasOwnProperty(cell)) { if (!twice.hasOwnProperty(cell)) { final.push(cell); } twice[cell] = 1; } else { once[cell] = 1; } } } if (final.length == 0) { Browser.msgBox("No duplicates found"); } else { Browser.msgBox("Duplicates are: " + final); } } Anyhow, sorry if this is the wrong place or format, but half of what I've found so far has been from stack, I thought it was a good place to start. Thanks!

    Read the article

  • Add Hyperlink to Cell in Excel 2007 Using Open XML SDK 2.0

    - by amurra
    I can't seem to find any documentation or code samples on how to add a hyperlink to a cell in Excel 2007 using the open xml sdk 2.0. I am using the following code, but is there a step I am missing? WorksheetPart workSheetPart = ExcelUtilities.GetWorkSheetPart(mWorkBookPart, "Program"); workSheetPart.AddHyperlinkRelationship(new Uri("http://www.google.com", UriKind.Absolute), true); workSheetPart.Worksheet.Save(); mWorkBookPart.Workbook.Save(); Then when I try and open the Excel document it says the file is corrupted because the relationship Id for the hyperlink cannot be found. How do you setup or create that relationship Id?

    Read the article

  • Unable to use XSSF with Excel 2007

    - by Tarun
    Hello All, I am having tough time getting to read data from excel 2007. I am using XSSF to read data from a specific cell of excel but keep getting error - Exception in thread "main" java.lang.NoSuchMethodError: org.apache.xmlbeans.XmlOptions.setSaveAggressiveNamespaces()Lorg/apache/xmlbeans/XmlOptions; at org.apache.poi.POIXMLDocumentPart.(POIXMLDocumentPart.java:46) This is my piece of code - public static void main(String [] args) throws IOException { InputStream ins = new FileInputStream("C:\\Users\\Tarun3Kumar\\Desktop\\test.xlsx"); XSSFWorkbook xwb = new XSSFWorkbook(ins); XSSFSheet sheet = xwb.getSheetAt(0); Row row = sheet.getRow(1); Cell cell = row.getCell(0); System.out.println(cell.getStringCellValue()); System.out.println("a"); } I have following jars added to build path - poi-3.6 poi-ooxml-3.6 poi-ooxml-schemas-3.6 x-bean.jar I could only figure out that "setSaveAggressiveNamespaces" has replaced "setSaveAggresiveNamespaces"....

    Read the article

  • Create a sub menu in existing menu in Excel Shared Add-in

    - by Sathish
    Hi I am developing a Excel shared Add-in which has the menu called Custom which is created using Excel Macros. Now i want to create a submenu under the Custom menu using Csharp Shared Add -in. Iam using the below code for doing this but no help oStandardBar = oCommandBars["Custom"]; oCmdBarCtrl = oStandardBar.Controls.Add(MsoControlType.msoControlPopup, Type.Missing, Type.Missing, Type.Missing, true); oCmdBarCtrl.Visible = false; oCmdBarCtrl.Caption = "Sub Menu1"; But it does not create a submenu, where as if i give "Help" in place of Custom i get the menu created. any work around for this?

    Read the article

  • Vertical-centering and overflow Excel-style in CSS?

    - by Eric Grange
    Is there a way to perform a vertical centering of a variable-sized multi-line content within a fixed-size div, with hidden overflow? The aim would be to reproduce what you can see in Excel cells: when the content fits the container, it should be vertically centered, when it is larger, the parts that overflow should be hidden (and the content still vertically aligned), like in an Excel cell whose neighbours aren't empty. I know how to vertically center using CSS, I know how to hide overflow when the content isn't vertically centered, but I've no idea how to do both at the same time... Is Javascript the only answer? The trick is that CSS positioning approaches don't work with variable-sized content (my content is dynamic text), and when you use display:table-cell, it effectively disables CSS overflow control (and the container grows to accomodate the content).

    Read the article

  • Problem with LINQ Generated class and IEnumerable to Excel

    - by mehmet6parmak
    Hi all, I wrote a method which exports values to excel file from an IEnumerable parameter. Method worked fine for my little test class and i was happy till i test my method with a LINQ class. Method: public static void IEnumerableToExcel<T>(IEnumerable<T> data, HttpResponse Response) { Response.Clear(); Response.ContentEncoding = System.Text.Encoding.Default; Response.Charset = "windows-1254"; // set MIME type to be Excel file. Response.ContentType = "application/vnd.ms-excel;charset=windows-1254"; // add a header to response to force download (specifying filename) Response.AddHeader("Content-Disposition", "attachment;filename=\"ResultFile.xls\""); Type typeOfT = typeof(T); List<string> result = new List<string>(); FieldInfo[] fields = typeOfT.GetFields(); foreach (FieldInfo info in fields) { result.Add(info.Name); } Response.Write(String.Join("\t", result.ToArray()) + "\n"); foreach (T t in data) { result.Clear(); foreach (FieldInfo f in fields) result.Add((typeOfT).GetField(f.Name).GetValue(t).ToString()); Response.Write(String.Join("\t", result.ToArray()) + "\n"); } Response.End(); } My Little Test Class: public class Mehmet { public string FirstName; public string LastName; } Two Usage: Success: Mehmet newMehmet = new Mehmet(); newMehmet.FirstName = "Mehmet"; newMehmet.LastName = "Altiparmak"; List<Mehmet> list = new List<Mehmet>(); list.Add(newMehmet); DeveloperUtility.Export.IEnumerableToExcel<Mehmet>(list, Response); Fail: ExtranetDataContext db = new ExtranetDataContext(); DeveloperUtility.Export.IEnumerableToExcel<User>(db.Users, Response); Fail Reason: When the code reaches the code block used to get the fields of the template(T), it can not find any field for the LINQ Generated User class. For my weird class it works fine. Why? Thanks...

    Read the article

  • Importing an Excel WorkSheet into a Datatable

    - by Nick LaMarca
    I have been asked to create import functionality in my application. I am getting an excel worksheet as input. The worksheet has column headers followed by data. The users want to simply select an xls file from their system, click upload and the tool deletes the table in the database and adds this new data. I thought the best way would be too bring the data into a datatable object and do a foeach for every row in the datatable insert row by row into the db. My question is what can anyone give me code to open an excel file, know what line the data starts on in the file, and import the data into a datable object?

    Read the article

  • Cost-effective .Net solutions for report generation in Excel and PDF

    - by jamesaharvey
    I'm looking for some cost-effective solutions and/or open source options for generating reports in Excel and PDF format. I realize some of the open source options may have less in terms of functionality and flexibility than the COTS versions with all the bells and whistles, but are there any options out there that fall somewhere in between? EDIT: Essentially what I'll have are just some basic HTML reports of data in tables with some calculations/summary data but nothing fancy like graphs, etc. I'll then need the ability to export these HTML reports to Excel and/or PDF.

    Read the article

  • problem with parsing string from excel file

    - by ohana
    hi, i have ruby code to parse data in excel file using Parseexcel gem. I need to save 2 columns in that file into a Hash, here is my code: worksheet.each { |row| if row != nil key = row.at(1).to_s.strip value = row.at(0).to_s.strip if !parts.has_key?(key) and key.length 0 parts[key] = value end end } however it still save duplicate keys into the hash: "020098-10". I checked the excel file at the specified row and found the difference are " 020098-10" and "020098-10". the first one has a leading space while the second doesn't. I dont' understand is it true that .strip function already remove all leading and trailing white space? also when i tried to print out key.length, it gave me these weird number: 020098-10 length 18 020098-10 length 17 which should be 9....

    Read the article

  • How to write a datatable to excel work book at client side

    - by senthilkumar
    Hi Guys Currently i am doing one project in that we need to generate report from database. Since my server memory is too low im getting 'Out of Memory' Exception when im writing it at serverside and also when i write directly to a excel file using http header as excel file im not able to create multiple sheets since my database table is huge more than 65536 rows. I saw many solution using a third party tool but i cant use those into mine..If anyone already worked on this please give me some direction. Also i tried using javascript but for that i need to use datagrid at server side?? but in my project i m not allowed to use like this.

    Read the article

  • SQL Server 2000, how to automate import data from excel

    - by Stan
    Say the source data comes in excel format, below is how I import the data. Converting to csv format via MS Excel Roughly find bad rows/columns by inspecting backup the table that needs to be updated in SQL Query Analyzer truncate the table (may need to drop foreign key constraint as well) import data from the revised csv file in SQL Server Enterprise Manager If there's an error like duplicate columns, I need to check the original csv and remove them I was wondering how to make this procedure more effecient in every step? I have some idea but not complete. For step 2&6, using scripts that can check automatically and print out all error row/column data. So it's easier to remove all errors once. For step 3&5, is there any way to automatically update the table without manually go through the importing steps? Could the community advise, please? Thanks.

    Read the article

  • Get only Excel column names in C#

    - by Newbie
    Is there any easy way apart from ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+fileName+";Extended Properties='Excel 8.0;HDR=YES;IMEX=1'"; using (objConn = new OleDbConnection(ConnectionString)) { objConn.Open(); Logger.Info("Reading the file "+fileName+"...."); objCmdSelect = new OleDbCommand("SELECT * FROM [" + sheetName + "$] WHERE 0 = 1", objConn); objAdapter = new OleDbDataAdapter(); objAdapter.SelectCommand = objCmdSelect; objDataset = new DataSet(); Logger.Info("Filling the dataset...."); objAdapter.Fill(objDataset, fileName); Logger.Info("Returning the dataset...."); return objDataset; } and then looping the datatables for getting the excel column names given a filename and sheet name? Using C#(and no interop services) Thanks

    Read the article

  • PHP --> MSSQL + Excel file upload from a specific row

    - by lucky
    Hello, I have a requirement in which, i need to upload an excel file into MSSQL database. It is working well till this point. But sometimes i am getting excel file in such a way, that the first 2 rows and columns are empty rows. That is not even fixed everytime. so the format of the table after upload is not as expected. It is assigning F1, F2 as column names for the table in mssql. It varies from file to file. I want to program it in such away so that the user can enter the row number and the column number from where the actual data is starting. So that while upload it should from line 3 and column 2. I dont know how to specify that row and column while uploading. Please help me to solve the same.

    Read the article

  • PHP --> SQL Server + Excel file upload from a specific row

    - by lucky
    I have a requirement in which, i need to upload an excel file into SQL Server database. It is working well till this point. But sometimes i am getting excel file in such a way, that the first 2 rows and columns are empty rows. That is not even fixed every time. so the format of the table after upload is not as expected. It is assigning F1, F2 as column names for the table in SQL Server. It varies from file to file. I want to program it in such away so that the user can enter the row number and the column number from where the actual data is starting. So that while upload it should from line 3 and column 2. I don't know how to specify that row and column while uploading. Please help me to solve the same.

    Read the article

  • Daylight Savings Handling in DateDiff() in MS Access?

    - by PowerUser
    I am fully aware of DateDiff()'s inability to handle daylight savings issues. Since I often use it to compare the number of hours or days between 2 datetimes several months apart, I need to write up a solution to handle DST. This is what I came up with, a function that first subtracts 60 minutes from a datetime value if it falls within the date ranges specified in a local table (LU_DST). Thus, the usage would be: datediff("n",Conv_DST_to_Local([date1]),Conv_DST_to_Local([date2])) My question is: Is there a better way to handle this? I'm going to make a wild guess that I'm not the first person with this question. This seems like the kind of thing that should have been added to one of the core reference libraries. Is there a way for me to access my system clock to ask it if DST was in effect at a certain date & time? Function Conv_DST_to_Local(X As Date) As Date Dim rst As DAO.Recordset Set rst = CurrentDb.OpenRecordset("LU_DST") Conv_DST_to_Local = X While rst.EOF = False If X > rst.Fields(0) And X < rst.Fields(1) Then Conv_DST_to_Local = DateAdd("n", -60, X) rst.MoveNext Wend End Function Notes I have visited and imported the BAS file of http://www.cpearson.com/excel/TimeZoneAndDaylightTime.aspx. I spent at least an hour by now reading through it and, while it may do its job well, I can't figure out how to modify it to my needs. But if you have an answer using his data structures, I'll take a look. Timezones are not an issue since this is all local time.

    Read the article

  • Getting SQL Syntax Error in INSERT INTO statement in Access 2010

    - by hello123
    I have written the following Insert Into statement in Access 2010 VBA: Private Sub AddBPSSButton_Click() ' CurrentDb.Execute "INSERT INTO TabClearDetail(C_Site) VALUES(" & Me.C_Site & ")" Dim strSQL As String 'MsgBox Me.[Clearance Applying For] 'MsgBox Me.[Contract Applying for] 'MsgBox Me.[C_Site] 'MsgBox Me.[C_SponsorSurname] 'MsgBox Me.[C_SponsorForename] 'MsgBox Me.[C_SponsorContactDetails] 'MsgBox Me.[C_EmploymentDetail] 'MsgBox Me.[C_SGNumber] 'MsgBox Me.[C_REF1DateRecd] 'MsgBox Me.[C_REF2DateRecd] 'MsgBox Me.[C_IDDateRecd] 'MsgBox Me.[C_IDNum] 'MsgBox Me.[C_CriminalDeclarationDate] 'MsgBox Me.[Credit Check Consent] 'MsgBox Me.[C_CreditCheckDate] 'MsgBox Me.[Referred for Management Decision] 'MsgBox Me.[Management Decision Date] 'MsgBox Me.[C_Comment] 'MsgBox Me.[C_DateCleared] 'MsgBox Me.[C_ClearanceLevel] 'MsgBox Me.[C_ContractAssigned] 'MsgBox Me.[C_ExpiryDate] 'MsgBox Me.[C_LinKRef] 'MsgBox Me.[C_OfficialSecretsDate] strSQL = "INSERT INTO TabClearDetail(Clearance Applying For, Contract Applying for, " & _ "C_Site, C_SponsorSurname, C_SponsorForename, C_SponsorContactDetails, C_EmploymentDetail, " & _ "C_SGNumber, C_REF1DateRecd, C_RED2DateRecd, C_IDDateRecd, C_IDNum, " & _ "C_CriminalDeclarationDate, Credit Check Consent, C_CreditCheckDate, Referred for Management Decision, " & _ "Management Decision Date, C_Comment, C_DateCleared, C_ClearanceLevel, C_ContractAssigned, " & _ "C_ExpiryDate, C_LinkRef, C_OfficialSecretsDate) VALUES('" & Me.[Clearance Applying For] & "', " & _ "'" & Me.[Contract Applying for] & "', '" & Me.[C_Site] & "', '" & Me.[C_SponsorSurname] & "', " & _ "'" & Me.[C_SponsorForename] & "', '" & Me.[C_SponsorContactDetails] & "', " & _ "'" & Me.[C_EmploymentDetail] & "', '" & Me.[C_SGNumber] & "', '" & Me.[C_REF1DateRecd] & "', " & _ "'" & Me.[C_REF2DateRecd] & "', '" & Me.[C_IDDateRecd] & "', '" & Me.[C_IDNum] & "', " & _ "'" & Me.[C_CriminalDeclarationDate] & "', '" & Me.[Credit Check Consent] & "', '" & Me.[C_CreditCheckDate] & "', " & _ "'" & Me.[Referred for Management Decision] & "', '" & Me.[Management Decision Date] & "', " & _ "'" & Me.[C_Comment] & "', '" & Me.[C_DateCleared] & "', '" & Me.[C_ClearanceLevel] & "', " & _ "'" & Me.[C_ContractAssigned] & "', '" & Me.[C_ExpiryDate] & "', '" & Me.[C_LinKRef] & "', " & _ "'" & Me.[C_OfficialSecretsDate] & "');" DoCmd.RunSQL (strSQL) 'MsgBox strSQL End Sub All The MsgBox calls work, so I believe I have typed all column names and text box names correctly. I am getting a Syntax error when I get to the DoCmd.RunSQL line. Have been staring at this for quite a while trying to see if I have missed a comma or speech mark or something, but am hoping maybe another set of eyes will see my mistake. Any help will be greatly appreciated. Thanks!

    Read the article

  • Extract the vb code associated with a macro attached to an Action button in PowerPoint

    - by Patricker
    I have about 25 PowerPoint presentations, each with at least 45 slides. On each slide is a question with four possible answers and a help button which provides a hint relevant to the question. Each of the answers and the help button is a PowerPoint Action button that launches a macro. I am attempting to migrate all the questions/answers/hints into a SQL Database. I've worked with Office.Interop before when working with Excel and Word and I have plenty of SQL DB experience, so I don't foresee any issues with actually extracting the text portion of the question and answer and putting it into the db. What I have no idea how to do is given an object on a slide - get the action button info - Get the macro name - and finally get the macro's vb code. From there I can figure out how to parse out which is the correct answer and what the text of the hint is. Any help/ideas would be greatly appreciated. The guy I'm doing this for said he is willing to do it by hand... but that would take a while.

    Read the article

  • Office 2003 interop problems, interface, method not found.

    - by Snake
    This problem is making me crazy. Actually I have multiple problems. First one: Why on earth are is there a _Worksheet and a Worksheetinterface in the Excel interop. They both look the same, except for some attributes on the methods. It's confusing! Second of all: my job today is making a VB.NET file more strict, by settings Option Strict On and Option Explicit On While it works for most files, I'm bumping into a problem. Here's a little code piece: Private _pivotTable As Excel.PivotTable With _pivotTable pvf = .AddDataField(pvc) End With PivotTable.AddDataField is defined on the MSDN page: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.pivottable.adddatafield(office.11).aspx When I check my local Interop dll w/ Reflector that method is NOT there. When I run the application, and step through it, the method just works. When I try to step INTO the method, I get an LateBound Exception. WTF? So the question is: why are the interfaces defined more than once (twice sometimes?). 2nd question. AddDataField trouble

    Read the article

< Previous Page | 100 101 102 103 104 105 106 107 108 109 110 111  | Next Page >