excel

Excel VBA Assignment by value or by reference?

只愿长相守 提交于 2021-02-10 13:29:14
问题 I have two objects of the same class which have a property that's an array of doubles (Double()), and I would like to do the following: Obj1.arr_property = Obj2.arr_property Is the above going to assign by value or by reference? If by reference, how to make it by value instead? 回答1: Everything that you assign with Set only copies the reference to the new variable, not the data. You do not use Set , so all values of the array are copied, not just the reference to the array. You actually cannot

Excel Formula T.INV Calculation wrong using C#

走远了吗. 提交于 2021-02-10 13:17:05
问题 In Excel =T.INV(0.9,5) returns the value ' 1.475884 '. Now I am using the function of WorksheetFunction TINV(0.9,5) in C#. But this gives me result 0.1321751752 . So, in C# TINV result has too much different value than excel. Microsoft.Office.Interop.Excel.Application xl = new Microsoft.Office.Interop.Excel.Application(); Microsoft.Office.Interop.Excel.WorksheetFunction wsf = xl.WorksheetFunction; double result = wsf.TInv(0.9, 5); Using another NuGet DLL also found same value as previous DLL:

run macro when open workbook

拜拜、爱过 提交于 2021-02-10 13:16:58
问题 I have done a search. The most relevant suggests the macro name of "workbook_open" But I still must manually invoke the module. Here's what I've coded. (Any other suggestions welcome as this is my first vba script -- at age 73) Sub Workbook_Open() Dim lastRow As Long 'last row with data Dim thisDate As Double 'start timestamp thisDate = Now() With Sheets("Pressure Log") lastRow = .Range("B" & .Rows.Count).End(xlUp).Row 'populate next row with date/time Range("B" & lastRow).Offset(1) = Format

run macro when open workbook

感情迁移 提交于 2021-02-10 13:16:52
问题 I have done a search. The most relevant suggests the macro name of "workbook_open" But I still must manually invoke the module. Here's what I've coded. (Any other suggestions welcome as this is my first vba script -- at age 73) Sub Workbook_Open() Dim lastRow As Long 'last row with data Dim thisDate As Double 'start timestamp thisDate = Now() With Sheets("Pressure Log") lastRow = .Range("B" & .Rows.Count).End(xlUp).Row 'populate next row with date/time Range("B" & lastRow).Offset(1) = Format

run macro when open workbook

梦想的初衷 提交于 2021-02-10 13:16:32
问题 I have done a search. The most relevant suggests the macro name of "workbook_open" But I still must manually invoke the module. Here's what I've coded. (Any other suggestions welcome as this is my first vba script -- at age 73) Sub Workbook_Open() Dim lastRow As Long 'last row with data Dim thisDate As Double 'start timestamp thisDate = Now() With Sheets("Pressure Log") lastRow = .Range("B" & .Rows.Count).End(xlUp).Row 'populate next row with date/time Range("B" & lastRow).Offset(1) = Format

Excel Formula T.INV Calculation wrong using C#

家住魔仙堡 提交于 2021-02-10 13:15:17
问题 In Excel =T.INV(0.9,5) returns the value ' 1.475884 '. Now I am using the function of WorksheetFunction TINV(0.9,5) in C#. But this gives me result 0.1321751752 . So, in C# TINV result has too much different value than excel. Microsoft.Office.Interop.Excel.Application xl = new Microsoft.Office.Interop.Excel.Application(); Microsoft.Office.Interop.Excel.WorksheetFunction wsf = xl.WorksheetFunction; double result = wsf.TInv(0.9, 5); Using another NuGet DLL also found same value as previous DLL:

Excel Formula T.INV Calculation wrong using C#

一曲冷凌霜 提交于 2021-02-10 13:11:55
问题 In Excel =T.INV(0.9,5) returns the value ' 1.475884 '. Now I am using the function of WorksheetFunction TINV(0.9,5) in C#. But this gives me result 0.1321751752 . So, in C# TINV result has too much different value than excel. Microsoft.Office.Interop.Excel.Application xl = new Microsoft.Office.Interop.Excel.Application(); Microsoft.Office.Interop.Excel.WorksheetFunction wsf = xl.WorksheetFunction; double result = wsf.TInv(0.9, 5); Using another NuGet DLL also found same value as previous DLL:

Excel: creating an array with n times a constant

两盒软妹~` 提交于 2021-02-10 12:33:07
问题 I have been looking around for a while but unable to find an answer to my question. In Excel, what compact formula can I use to create an array made up of a single element repeated n times, where n is an input (potentially hard-coded)? For example, something that would look like this (the formula below does not work but gives an idea of what I am looking for): {={"Constant"}*3} Note: I am not looking for a VBA-based solution. 回答1: One could concatenating 1:n empty cells to the "Constant" for

Creating pie chart in python

隐身守侯 提交于 2021-02-10 12:13:25
问题 I have created my pie chart but right now I am using a range of cells like this: chart3.add_series({ 'name': 'Pie data', 'categories': '=Pivots!$A$3:$A$10', 'values': '=Pivots!$F$3:$F$10'}) which gives me a pie chart with the categories that are found in A3-A10 and values that correspond from cells F3-F10. The problem I am having is unfortunately I am not always going to have data in each of these cells. so I may have data in one worksheet that has categories and values that may range from A3

How do I use my first row in my spreadsheet for my Dataframe column names instead of 0 1 2…etc?

二次信任 提交于 2021-02-10 12:12:41
问题 I want my dataframe to display the first row names as my dataframe column name instead of numbering from 0 etc. How do I do this? I tried using pandas and openpyxl modules to turn my Excel spreadsheet into a dataframe. import pandas as pd from openpyxl import load_workbook from openpyxl.utils.dataframe import dataframe_to_rows wb = load_workbook(filename='Budget1.xlsx') print(wb.sheetnames) sheet_ranges=wb['May 2019'] print(sheet_ranges['A3'].value) ws=wb['May 2019'] df=pd.DataFrame(ws.values