excel-2010

Simple Example of VSTO Excel using a worksheet as a datasource

爷,独闯天下 提交于 2019-12-03 17:06:49
问题 I think I'm running into a case of "the easiest answers are the hardest ones to find" and I haven't come across any searches that give this to me in a straightforward way. This is for Excel 2010 and VS 2010 within an existing VSTO (C#) project. I have an Excel worksheet that contains 4 columns of data that I would like to use as a source for a DataGridView. Can someone please provide C# code snippets for (1) getting the data from a particular worksheet and populating a custom object with it?

wrong PDF output size with ExportAsFixedFormat in Excel VBA

送分小仙女□ 提交于 2019-12-03 16:12:50
I use Excel 2010 with VBA. I have the following code : mySh.PageSetup.PaperSize = xlPaperLetter mySh.ExportAsFixedFormat Type:=xlTypePDF, _ Filename:=filePathTmp, _ Quality:=xlQualityStandard, IncludeDocProperties:=False, _ IgnorePrintAreas:=False, OpenAfterPublish:=False It generates a PDF without error but the size is not correct. I get a 22.26 x 28.80 cm instead of the 21.59 x 27.94 cm that I would like to obtain. Any ideas ? Thanks for your help I use Excel 2010 and had this problem. I fixed it by changing the printer in Excel's dropdown list on the Print section of the File tab. My

How to delete Certain Characters in a excel 2010 cell

旧巷老猫 提交于 2019-12-03 15:59:43
问题 In column A I have a load of name that look like this [John Smith] I still want them in A but the [] removed... 回答1: If [John Smith] is in cell A1, then use this formula to do what you want: =SUBSTITUTE(SUBSTITUTE(A1, "[", ""), "]", "") The inner SUBSTITUTE replaces all instances of "[" with "" and returns a new string, then the other SUBSTITUTE replaces all instances of "]" with "" and returns the final result. 回答2: Replace [ with nothing, then ] with nothing. 回答3: Another option: =MID(A1,2

Non-volatile UDF always recalculating

爱⌒轻易说出口 提交于 2019-12-03 14:25:41
问题 I am trying to make a non-volatile UDF but it seems not possible. So here is a my very simple test-UDF: Option Explicit Dim i As Integer Sub Main() i = 0 [A1] = "zyy" MsgBox i End Sub Function Test(rng As Range) Application.Volatile (False) Test = rng.Value i = i + 1 End Function I got a otherwise empty worksheet that uses this function a couple of times, and every time I call Main() and change any cell on the sheet with the UDFs all of them recalculate. How can I make this (any) UDF no

How to compare two csv files in windows

a 夏天 提交于 2019-12-03 14:00:57
I need to compare two csv files in windows7. How can I proceed to achieve this. I want to see the differences in both the files , like we can use tkdiff in Linux. Suggestion: Press Windows + R shortcut to open windows' Run prompt Type in cmd and press Enter to open a DOS terminal cmd window Change the current path by running the command cd C:\path\to\your\directory to reach the location of the two CSV files Tip : To paste a copied path from clipboard into DOS terminal cmd window, you can either (1) right-click on terminal window, or (2) press Shift + Insert . Finally, to compare the two files,

Query Tables (QueryTables) in Excel 2010 with VBA with VBA creating many connections

ⅰ亾dé卋堺 提交于 2019-12-03 13:44:40
问题 I'm following code I found on another site. Here's the basics of my code: Dim SQL As String Dim connString As String connString = "ODBC;DSN=DB01;UID=;PWD=;Database=MyDatabase" SQL = "Select * from SomeTable" With Worksheets("Received").QueryTables.Add(Connection:=connString, Destination:=Worksheets("Received").Range("A5"), SQL:=SQL) .Refresh End With End Sub The problem with doing this is every single time they hit the button assigned to this it creates a new connection and doesn't ever seem

Could Anyone Show List of Button Face Id in Excel 2010

扶醉桌前 提交于 2019-12-03 12:47:39
问题 I would like to create costum menu button using VBA in my excel 2010 file using predefined excel button that use face id. In my case i would like to use "lock" and "refresh" icon, but doesn`t know the face id for that icon. could anyone show or point me the list of button and face id used in excel 2010? 回答1: Have a look here: Face ID's Its an addin for MS excel. Works for excel 97 and later. 回答2: The following Sub BarOpen() works with Excel 2010, most probably also many other versions also,

Excel Data Connection errors on Refresh

丶灬走出姿态 提交于 2019-12-03 12:25:58
Solved! See below for solution! I'm in Excel 2010 connecting to multiple, seperate Access 2010 db's from Excel through PivotTable data connections. Refreshing all my connections causes the final refresh to fail. The order does not matter, I've manually refreshed in different orders, same error. However, if I save and close after refreshing a few, then come back and refresh the last one, there is no problem at all. Leads me to believe that I'm hitting some sort of memory cap that is reset when I save and close. Can I re-create that effect through VBA without actually save/closing? Is there a

Excel formula to remove space between words in a cell

倖福魔咒の 提交于 2019-12-03 10:48:07
问题 I've a huge data in excel file. For eg: say i've a word like paul son,i've to make it as paulson. input: paul son output: paulson . In some cells ,i've data like mic-li ,when this type of words come,it should not replace any thing,it should only remove spaces in between words. 回答1: Suppose the data is in the B column, write in the C column the formula: =SUBSTITUTE(B1," ","") Copy&Paste the formula in the whole C column. edit : using commas or semicolons as parameters separator depends on your

How to get unique values in a column using excel formula

我的未来我决定 提交于 2019-12-03 10:02:50
I have Excel Data like below JID Val 1001 22 1030 6 1031 14 1041 8 1001 3 2344 8 1030 8 2344 6 1041 8 How do i get the unique JID values like below using formula? UJID 1001 1030 1031 1041 2344 You can use the remove duplicate function Select the column range Go to Data Tab then click on Remove Duplicates Here is a solution to get a list of unique items from your tables There is two parts to this solution. Part 1) Unique Count {=SUM(IF(FREQUENCY(IF($A$2:$A$10<>"",MATCH($A$2:$A$10,$A$2:$A$10,0)),ROW($A$2:$A$10)-ROW($A$2)+1),1))} This will count the number of unique items in your data table and