worksheet

How can I get the specific column in excel worksheet using DocumentFormat.OpenXml C#?

这一生的挚爱 提交于 2021-02-20 02:14:55
问题 As the title, I would like to get a specific column in excel worksheet using OpenXML in C# for setting hidden property. Like that: var columns = worksheet.GetFirstChild<Columns>(); var column = columns.FirstOrDefault(c=>c.ColumnIndex == 4); column.Hidden = true; The code above is just a sample for my idea. Is there any way for solving my problem? 回答1: per: https://docs.microsoft.com/en-us/office/open-xml/how-to-get-a-column-heading-in-a-spreadsheet , workSheetPart.Worksheet.Descendants() in

How can I get the specific column in excel worksheet using DocumentFormat.OpenXml C#?

泄露秘密 提交于 2021-02-20 02:11:51
问题 As the title, I would like to get a specific column in excel worksheet using OpenXML in C# for setting hidden property. Like that: var columns = worksheet.GetFirstChild<Columns>(); var column = columns.FirstOrDefault(c=>c.ColumnIndex == 4); column.Hidden = true; The code above is just a sample for my idea. Is there any way for solving my problem? 回答1: per: https://docs.microsoft.com/en-us/office/open-xml/how-to-get-a-column-heading-in-a-spreadsheet , workSheetPart.Worksheet.Descendants() in

Copy excel sheet from one worksheet to another in Python

六眼飞鱼酱① 提交于 2021-02-08 04:41:43
问题 All I want to do is copy a worksheet from an excel workbook to another excel workbook in Python. I want to maintain all formatting (coloured cells, tables etc.) I have a number of excel files and I want to copy the first sheet from all of them into one workbook. I also want to be able to update the main workbook if changes are made to any of the individual workbooks. It's a code block that will run every few hours and update the master spreadsheet. I've tried pandas, but it doesn't maintain

Reference to last worksheet in Excel Function to Sum same range across multiple sheets

谁说胖子不能爱 提交于 2021-01-04 07:17:58
问题 I've tried a few formula options but nothing is quite working the way I would like it to. I'm using a very simple SUM formula to total across all the worksheets in my workbook. Currently it's set up like this: =SUM('1:10'!D3) However, I'm likely going to add more worksheets and I want them included in this total. I've tried a few different versions of "wshNameLast" or "getlastwsname" that I've found in different articles here but they are all giving me a #REF error. Is there a formula I'm

Reference to last worksheet in Excel Function to Sum same range across multiple sheets

余生长醉 提交于 2021-01-04 07:12:39
问题 I've tried a few formula options but nothing is quite working the way I would like it to. I'm using a very simple SUM formula to total across all the worksheets in my workbook. Currently it's set up like this: =SUM('1:10'!D3) However, I'm likely going to add more worksheets and I want them included in this total. I've tried a few different versions of "wshNameLast" or "getlastwsname" that I've found in different articles here but they are all giving me a #REF error. Is there a formula I'm

Reducing WithEvent declarations and subs with VBA and ActiveX

杀马特。学长 韩版系。学妹 提交于 2020-08-26 09:43:26
问题 On a worksheet I have 3 ActiveX objects being TextBox1, TextBox2, ListBox1 Leaving other code out I have a class clsEvents that contains Private WithEvents txbControl As MSForms.TextBox Private WithEvents lisControl As MSForms.ListBox Private txbEvents As TextBoxEvents Private lisEvents As ListBoxEvents Private Sub txbControl_Change() txbEvents.ChangeEvent txbControl End Sub Private Sub lisControl_Change() lisEvents.ChangeEvent lisControl End Sub and the classes TextBoxEvents and

Copy a worksheet to a new workbook with paste values and keeping formats

情到浓时终转凉″ 提交于 2020-08-10 19:43:28
问题 I am trying to copy one worksheet to a new workbook, pasting all formulas as values while remaining all formats, sheetname, etcetera. The new file name should be "University" and stored on the same location as the original file. I have been struggling with this, as it keeps returning an "Error 1004: PasteSpecial method of Range class failed" with my current (copied) script: Sub new_workbook() Dim Output As Workbook Dim FileName As String Set Output = Workbooks.Add Application.DisplayAlerts =

How to refer to a Excel Worksheet by its VBA Object Name in another Workbook?

做~自己de王妃 提交于 2020-07-09 12:10:08
问题 I have two Excel Workbooks: Source.xlsx Tool.xlsm Source.xlsx contains a Worksheet with the VBA Object Name shtTests : Let's assume that in Tool.xlsm I have a variable that contains a reference to the Workbook stored in Source.xlsx : Dim wkbSource as Workbook Set wkbSource = GetSourceWorkbook() ' Some function that gives a reference to the workbook Core Question: How can I reference shtTests within Tool.xlsm by using shtTests ' VBA Name ? Or to formulate the question as code... assume you

How to refer to a Excel Worksheet by its VBA Object Name in another Workbook?

℡╲_俬逩灬. 提交于 2020-07-09 12:09:21
问题 I have two Excel Workbooks: Source.xlsx Tool.xlsm Source.xlsx contains a Worksheet with the VBA Object Name shtTests : Let's assume that in Tool.xlsm I have a variable that contains a reference to the Workbook stored in Source.xlsx : Dim wkbSource as Workbook Set wkbSource = GetSourceWorkbook() ' Some function that gives a reference to the workbook Core Question: How can I reference shtTests within Tool.xlsm by using shtTests ' VBA Name ? Or to formulate the question as code... assume you

Dynamically add checkboxes and event handler to a worksheet

纵饮孤独 提交于 2020-06-27 04:37:34
问题 In my sheet in column B I have names of components In column A I would like to have checkboxes which are dynamically added, as the list of names in column B will increase over time I need to be able to do the following: - handle the events (onclick) as ticking/unticking the checkboxes hides/unhides rows in another sheet - return the status of each checkbox as I cycle through the checkboxes in another module (onclick from a commandbox) and depending on the status an action follows or not -