worksheet

Programmatically creating worksheets in an Excel Add In (C#)

懵懂的女人 提交于 2019-12-24 00:54:24
问题 According to MSDN, one can programmatically create and delete Excel Worksheets in Visual Studio (http://msdn.microsoft.com/en-us/library/6fczc37s.aspx). The code to do so is as follows: private void createNewAccount() { Excel.Worksheet newWorksheet; newWorksheet = Globals.ThisAddIn.Application.ThisWorkbook.Worksheets.Add(); } One of the forms in my project has a button carrying this code. The user is supposed to be able to press it and create a new worksheet, but it doesn't work. So I decided

VBA Excel - What methods/attributes can I use with ActiveSheet

匆匆过客 提交于 2019-12-23 20:10:38
问题 I have looked at the MSDN page, and also found this question helpful, but I would like to know exactly how ActiveSheet behaves. Is it like a Worksheet object? It sound like it just returns or references a Worksheet object. Do normal Worksheet methods and properties work with it? I have used it in code I copied from other sources, but I would like to understand what is happening under the hood. Thanks Bonus question: If I have a control on sheet2, then set active sheet to sheet1 in a userform,

MS Excel LOOKUP from top to bottom column

混江龙づ霸主 提交于 2019-12-23 20:04:28
问题 I have a problem finding a way for LOOKUP to search from top to bottom column. Here's the situation. I need to create a formula for Excel to search for hardware part inside a sentences. Example : Sentence (A1) Customer PC can't turn on. Check motherboard. Motherboard faulty. Replace motherboard. PSU don't have enough power. Replace PSU. Here is lookup range column(HARDWARE) replace PSU replace motherboard result range column(HARDWARE_PART) PSU motherboard The formula I use is LOOKUP(9999

How create single HTML file to viewed in Excel with multiple sheets?

两盒软妹~` 提交于 2019-12-22 08:59:55
问题 I would like to know if it is possible to create a single HTML file which (after changing its extension to .xls) when opened with Excel, will parsed to multiple sheets. Little example : I've got a file test.xls with the content : <html> <body> <table> <tr> <td> 1 </td> <td> 2 </td> <td> 3 </td> <td> =sum(A1:C1) </td> </tr> </table> </body> </html> When I open this file with Excel I get one Sheet with calculated sum of cells A1 to C1 in A4=6. I wonder if it is possible to create an HTML file

Configure working directory of Scala worksheet

旧时模样 提交于 2019-12-22 04:14:08
问题 I would like the working directory for Scala worksheet (and the Scala interpreter) to be the Eclipse project path rather than the Eclipse installation directory. How can I (non programmatically) achieve that? I know that I can use System.setProperty("user.dir", "...") , but IMHO that does not belong in the code. Further, it does not seem to work: object ScratchWS { System.setProperty("user.dir", "C:\\") //> res0: String = C:\adt-bundle-windows-x86_64-20130219\eclipse new File("putty.exe")

Change the background of Cells with C#

旧时模样 提交于 2019-12-21 07:19:31
问题 I'm developing an program using C# to manipulate an Excel document, and I'm using Microsoft.Office.Interop.Excel._Worksheet worksheet; When I insert something to a x,y cell I use : worksheet.Cells[x, y] = "something"; Now I want to know if it's possible to change the backColor of the Cells[x,y] from C#. Thank you. 回答1: Try worksheet.Cells[x, y].Interior.Color You won't be able to use the Colors in .Net directly, they will require a translation. It is recommended to use the following

Copying Excel Worksheets in POI

為{幸葍}努か 提交于 2019-12-21 03:33:07
问题 Does anyone know of a means to copy a worksheet from one workbook to another using POI? The Workbook class has a cloneSheet method, but there doesn't seem to be able to insert a cloned sheet into a new workbook? If there isn't an API to do this easily, does anyone have the code to copy all of the data (styles, column widths, data, etc) from one sheet to another? The jxls has methods to copy sheets, but they don't work when copying between workbooks. 回答1: i have implemented some functionality

How can I get worksheet code name to activate a specific worksheet?

六眼飞鱼酱① 提交于 2019-12-20 05:49:10
问题 I have a worksheet with the "tab" name of "Rpt_Group". I also renamed its code name to shData. When I use VBA to activate the worksheet using "Rpt_Group" it runs fine. But when I use the code name I get an error message "subscript out of range. This works: WBA.Worksheets("Rpt_Group").Activate This does not work: WBA.Worksheets("shData").Activate This does not work: WBA.shData.Activate Dim WBA As Workbook 'Open the desired workbook Set WBA = Workbooks.Open(Filename:="path & file name")

Trying to reference another worksheet in active workbook

偶尔善良 提交于 2019-12-20 04:56:27
问题 I am trying to make another worksheet active when command button is clicked, but I'm staying within the same active workbook: Sub Submit_Warranty() 'Set warranty data worksheet as active page Sheets("Sheet2").Activate 'Show the submit warranty user form Warranty_Input.Show End Sub I keep getting "subscript out of range" error. Any ideas? 回答1: If the code you posted is everything, then that error pretty much has to be from an invalid reference. So my guess would be that the actual displayed

Is it possible to convert an HTML document to Excel with multiple Worksheets/tabs?

♀尐吖头ヾ 提交于 2019-12-20 04:35:02
问题 I know we can send regular html files through the tubes and have the browser open them as Excel documents (you do that by changing http headers and the file name, then excel does the conversion). BUT, is it possible to get an HTML document show up in Excel with two Worksheets/Tabs? Here's what I thought might work, but didn't quite get the job done: <html> <body> <table> .... </table> <hr class='pageBreak' /> <= I thought perhaps this would divide stuff up <table> .... </table> <body> </html>