excel-2010

Pivottable woes

房东的猫 提交于 2019-12-02 00:27:06
It seems like all of the examples from other people are just like what I already have in my code. But in my case, nothing resolves the problem. So here is the complete code along with a break to show where I am having a problem: Sub CreatePivot() ' Define RngTarget and RngSource as Range type variables Dim RngTarget As Range Dim RngSource As Range Dim intLastCol As Integer Dim intLCPivot As Integer Dim intLRPivot As Integer Dim intCntrCol As Integer Dim intX, intY As Integer Dim ws1, ws2 As Worksheet Dim pt As PivotTable Dim cf As FormatCondition Set ws1 = ThisWorkbook.Sheets("Sheet1") Set ws2

How to query UTF-8 encoded CSV-files with VBA in Excel 2010?

蹲街弑〆低调 提交于 2019-12-02 00:10:44
问题 I would like to query an UTF-8 encoded CSV file using VBA in Excel 2010 with the following database connection: provider=Microsoft.Jet.OLEDB.4.0;;data source='xyz';Extended Properties="text;HDR=Yes;FMT=Delimited(,);CharacterSet=65001" All CSV files start with the BOM \xEF\xBB\xBF and the header line. Somehow the BOM isn't recognized correctly and the first column header gets read as "?header_name", i.e. a question mark gets prepended. I have tried different CharacterSets and I have also tried

How to find and highlight all occurrences of multiple strings within the ActiveSheet?

你离开我真会死。 提交于 2019-12-01 22:29:26
问题 I've found a solution already but the code would be too long. Then i decided to search a way of inserting all the words I want to find and highlight into a single Find Method. I came across some ideas of using Arrays to do so and used these 3 codes to write mine (this, this, and this) but I am a new user of VBA so my final code have a problem, it highlights just the last String of the Array. I think the problem is logic but I don't know the basics of VBA so I have no idea how to correct it.

Exporting multiple pages to PDF in a specific order

依然范特西╮ 提交于 2019-12-01 22:14:50
I am trying to export pages from two different sheets of a workbook as 1 PDF. However, I want the pages to be in this order: 1 page from Sheet1, 5 pages from Sheet2, 2 pages from Sheet1. At the moment I am exporting these as 3 seperate PDFs and then merging them afterwards in another application. The code I have been using is below: ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:=sPath & quotept1filename, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, From:=1, To:=1, OpenAfterPublish:=False ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:

How to find and highlight all occurrences of multiple strings within the ActiveSheet?

大城市里の小女人 提交于 2019-12-01 21:20:13
I've found a solution already but the code would be too long. Then i decided to search a way of inserting all the words I want to find and highlight into a single Find Method. I came across some ideas of using Arrays to do so and used these 3 codes to write mine ( this , this , and this ) but I am a new user of VBA so my final code have a problem, it highlights just the last String of the Array. I think the problem is logic but I don't know the basics of VBA so I have no idea how to correct it. My actual code: Sub Sample() Dim fnd As String Dim MyAr Dim i As Long Dim rng As Range, FoundCell As

Set Rows to repeat at top when printing - Open XML and Excel

大兔子大兔子 提交于 2019-12-01 20:56:13
I am trying to get the first 4 rows of an xlsx file to repeat at the top of each page when printed. I am using the Open XML SDK to accomplish this. My file is being generated by the SSRS execution web service as a filestream. I then need to modify several layout and page settings (margins, page size, zoom, etc) before delivering the file to the user, as my users have very little Excel acumen. All other settings I need to tweak are working correctly, so I have stripped out all of that code from this example. When trying to set the repeating page headers using the code below, it executes with no

Could not find installable ISAM

拥有回忆 提交于 2019-12-01 20:54:58
I am trying to create program in .net using C# for uploading excel file, reading it and add record excel file to the sql server database from excel data. While doing so I have got an error: Could not find installable ISAM? Can someone help me how to fix this problem? Or may be provide some sample code to do such kind of assignment in different way? protected void Button1_Click(object sender, EventArgs e) { String excelConnectionString1; String fname = FileUpload1.PostedFile.FileName; if (FileUpload1.PostedFile.FileName.EndsWith(".xls")) { String excelsheet; FileUpload1.SaveAs(Server.MapPath("~

Excel Connectivity with SSAS - An error was encountered in the transport layer

风流意气都作罢 提交于 2019-12-01 20:41:27
I have a SSAS Cube in SQL 2012 to which I can connect from Excel 2010 without an issue using a windows user credentials. However whenever I restart the server hosting the cube and I try to refresh the pivot in the excel (in a client machine) it throws and an error saying " An error was encountered in the transport layer ". I am then prompted to re-enter the password for the windows account I am using to connect to the data source. The problem is that if I have couple of pivots open in different sheets in the same excel book per each pivot I am prompted to do this (even if I do a Refresh and

Calculate Percentile in Excel 2010

*爱你&永不变心* 提交于 2019-12-01 20:26:34
This is my below list. I am trying to calculate 95% of calls came back in how many millseconds. Milliseconds Number of Calls 45 14 46 33 47 40 48 41 49 83 50 114 51 124 52 82 53 89 54 99 55 82 56 72 57 80 58 101 59 73 60 74 61 81 62 64 63 70 64 61 What does above data means is- 14 calls came back in 45 milliseconds 33 calls came back in 46 milliseconds 40 calls came back in 47 milliseconds etc etc Now I am supposed to find out 95% percentile from the above data. Meaning 95% of time, calls came back in this milliseconds. Can anyone tell me how to do this in Excel Sheet? Thanks for the help I am

How to get the last modified file in a directory using VBA in Excel 2010

为君一笑 提交于 2019-12-01 19:10:19
Im looking for a way to do this in Excel 2010 using VBA. It used to be possible in Excel 2003 using the Application.FileSearch method, but this has be depreciated. (see below) Dim sFileName As String sFileName = "" With Application.FileSearch .NewSearch .LookIn = sDir .Filename = "*.*" .Execute msoSortByLastModified, msoSortOrderDescending If .FoundFiles.Count > 0 Then sFileName = .FoundFiles(1) End With Any ideas how to do this in Excel 2010? Thanks If using the FileSystemObject is acceptable, you could use the method described here . To summarize: Dim fso As Scripting.FileSystemObject Dim