excel-2010

VBA: Paste Values instead of formulas

♀尐吖头ヾ 提交于 2019-12-11 02:46:34
问题 I am new to vba. I want to copy certain values in cells from one tab into another with the following code. Sheets("Equities").Select Range("B5").Select Range(Selection, Selection.End(xlDown)).Select Range(Selection, Selection.End(xlToRight)).Select Selection.Copy Sheets("ZSM").Select Range("B5").Select ActiveSheet.Paste Sheets("Bonds").Select Range("B5").Select Range(Selection, Selection.End(xlDown)).Select Range(Selection, Selection.End(xlToRight)).Select Selection.Copy Sheets("ZSM").Select

Userform listbox to show values from a range

吃可爱长大的小学妹 提交于 2019-12-11 02:19:54
问题 I'm trying to create a Userform in Excel, where I have one ComboBox and based on the value chosen, values from a range of cells are to be shown in a listbox on the Userform. So far I have this. Private Sub UserForm_Initialize() With ComboBox1() .AddItem "Item1" .AddItem "Item2" .AddItem "Item3" .AddItem "Item4" .AddItem "Item5" .AddItem "Item6" .AddItem "Item7" End With End Sub Sub ComboBox1_Change() If ComboBox1.ListIndex = Outlook Then Range("A3:B11").Show Else If ComboBox1.ListIndex =

Reference the second row in named table for data validation

拥有回忆 提交于 2019-12-11 01:58:02
问题 I have a named table in excel called "FINAL". I would like to create the drop down list from the second row of the table. I know that we can use =FINAL[#Headers] to create a list from the headers, but I need to create it from the second row in the table. of course I need it to be dynamic and use the table name since the table is going to change. THanks 回答1: Step1: Add named range myList with formula: =INDEX(FINAL[#Data],2,0) Step2: Select any cell and add data validation with Source: =myList

.End(xlDown).Row changes from Excel 2007 to 2010

被刻印的时光 ゝ 提交于 2019-12-11 01:56:03
问题 After updating from Office 2007 to Office 2010, the macros that worked perfectly in Excel 2007 but do not work in 2010. Specifically i recieved a error on this line: y = Worksheets("Raw Data").Range("A2").End(xlDown).Row Ther error is "error 6 Overflow". I have come to realize that it is due to Excel selecting the max number(1048576) of rows in excel that creates the overflow. There is only data in 975 of these rows. In 2007 it only selected the rows with data. I am wondering what has caused

VBA Excel Save Copy as txt File

こ雲淡風輕ζ 提交于 2019-12-11 01:49:20
问题 Is it possible to save a copy of a workbook as txt file? I tried ThisWorkbook.SaveCopyAs("wb.txt") . However this saves the excel with txt without any file conversion. So when I open the text file no data is displayed. 回答1: Another way ThisFile = "Filename" code..... ActiveWorkbook.SaveAs Filename:="\folderlocation\" & ThisFile & ".txt", FileFormat:=xlText 回答2: Application.DisplayAlerts = False Dim s As String s = ActiveWorkbook.FullName s = Replace(s, "xlsx", "txt") ActiveWorkbook.SaveAs

Importing Excel files with a large number of columns header into mysql with c#

风格不统一 提交于 2019-12-11 01:45:22
问题 i just was just wondering, how do i import large excel files into mysql with c#? My coding experience isn't great and i was hoping if there's anyone out there who could give me some rough idea to start on it. So far, i was able to load excel files into datagridview with the following codes: string PathConn = " Provider=Microsoft.JET.OLEDB.4.0;Data Source=" + pathTextBox.Text + ";Extended Properties =\"Excel 8.0;HDR=Yes;\";"; OleDbConnection conn = new OleDbConnection(PathConn); conn.Open();

Application-Defined or Object-Defined Error Excel

柔情痞子 提交于 2019-12-11 01:10:14
问题 I have this sub in Excel 2010 that’s supposed to do the following: · Take the value in (6, 4) in Sheet1(Form) and find this value in Sheet7’s (Dates) column 1 · Find the row in which it finds this match · Find the value at Sheet7(row, 6) · Paste it into Sheet1(19, 5) Sheet1 is titled Form, and Sheet7 is titled Dates. This is the code that I’ve written. When I try to run it, it gives me a run-time error ‘1004: Application-defined or object-defined error’ at Sheets("Dates")... Any assistance

How to apply MATCH() function in VBA?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 00:41:06
问题 I am trying to run the code below but get Error 1004: Unable to get the Match property of the WorksheetFunction class. I understand if there is no match, MATCH() function returns #N/A , so there is no point to assign this to the INDEX variable (moreover, I think it might also cause an error). How can I account for this possibility? Sub Debugging() Workbooks("Problem.xls").Worksheets(1).Activate Cash_Rows = 5 Share_Rows = 6 If Cash_Rows <= Share_Rows Then Range("A1:A" & Cash_Rows).Select With

apache poi upgrade from 2.5 to 3.8 gives Excel error

这一生的挚爱 提交于 2019-12-10 23:12:07
问题 We need to provide support for Excel 2010 so have upgraded to Apache poi 3.8. But while downloading the excel it takes so much time for opening and also provides error message as "EXCEL found unreadable content. Do you want to recover the contents of this workbook? If you trust the source of this workbook, click yes" And after clicking "yes", it gives me one more pop up which says, Excel completed file level validation and repair. Some parts of this workbook may have been repaired or

Lock certain cells in a range

浪尽此生 提交于 2019-12-10 21:27:02
问题 I'm trying to loop through a range of cells, locking any cell that has content while leaving empty cells unlocked. When I run the below code the result is the entire sheet is locked. If I add an else statement the sheet is unlocked. Basically whatever the last .locked = (true, false) statement is is how the entire sheet winds up. Change 1 Is it possible that I have some setting on/off that is interfering since I'm the only one who is unable to get any of this to work? Sub ProtectTheSheet()