excel-2010

accessing individual array elements in VBA function

妖精的绣舞 提交于 2021-02-08 04:51:04
问题 VBA newbie here. I am trying to pass an array ( it is static, but please answer for dynamic range as well ) to a function. Then assign individual array elements to unique variables and use these variables in a custom formula. I just browsed around and wrote the code but keep getting #VALUE! error. The gist of the code is below: Public Function mytest(ByRef arr1 As Range) Dim A As Double Dim B As Double A = arr1(0) B = arr1(1) mytest = A + B 'The actual formula is a bit more complicated than

accessing individual array elements in VBA function

前提是你 提交于 2021-02-08 04:49:18
问题 VBA newbie here. I am trying to pass an array ( it is static, but please answer for dynamic range as well ) to a function. Then assign individual array elements to unique variables and use these variables in a custom formula. I just browsed around and wrote the code but keep getting #VALUE! error. The gist of the code is below: Public Function mytest(ByRef arr1 As Range) Dim A As Double Dim B As Double A = arr1(0) B = arr1(1) mytest = A + B 'The actual formula is a bit more complicated than

Creating a QueryTable in an Open XML Spreadsheet using C#

对着背影说爱祢 提交于 2021-02-07 18:36:16
问题 I have a number of report-generating ASMX webservices and would like to help our users by adding a link to download a .XLSX file containing a pre-configured and formatted Query Table for the webservice. They will then be able to build their own graphs and derived reports as they currently do, but also be able to refresh the data without rebuilding everything. var machStore = IsolatedStorageFile.GetMachineStoreForAssembly(); string fileName = Path.ChangeExtension(Path.GetRandomFileName(), "

Using ranges, how can I make a .COPY DESTINATION paste as VALUES

萝らか妹 提交于 2021-02-07 13:37:44
问题 I have the following code, which works just fine to copy the entire cells to their new destination. Dim ws As Worksheet, rng As Range Set ws = Sheets("Duplicates") Set rng = ws.Range("A2") rng.Copy Destination:=Range("A2:A" & Range("G" & Rows.Count).End(xlUp).Row) Is it possible to make that cope a paste special . Or do I need to split the copy/paste into two lines using a two range objects? EDIT: Right, we've concluded that you CANNOT have a paste special on the same line as a copy. What I

How to make an XLAM UDF call portable?

北战南征 提交于 2021-02-07 10:30:19
问题 It seems that when I call a UDF in an XLAM file, the path to the XLAM file is embedded in the spreadsheet. When I open the spreadsheet from another machine (which has the same XLAM add-in installed, just installed to a different path) then Excel complains "This workbook contains links to other data sources..." This doesn't seem to be a problem with UDFs in XLLs. Is there a way around this? 回答1: This behaviour is a consequence of the way Addin UDFs are implemented in Excel. There are 3

Excel - ActiveChart.SetSourceData Source: Runtime Error '445' : Object doesn't support this action

不问归期 提交于 2021-01-29 19:01:31
问题 I have an excel workbook (v2016), where I managed to get the table name of a table based on the highest number of entries. This value (which is a name of a table) is in Sheet "Pareto" Cell B4. I'm using the following code to update a chart using an above-mentioned table name Sub GetTables() Dim YTDL1TableName As String Dim YTDL1Range As Range YTDL1TableName = Sheets("Pareto").Range("B4") Set YTDL1Range = Sheets("Pareto").Range(Sheets("Pareto").ListObjects(YTDL1TableName).Range.Address(True,

find the first “To Date”, select the cells under “To Date” paste the value in the previous cells then go to the next To Date

坚强是说给别人听的谎言 提交于 2021-01-29 08:18:42
问题 I need your help in order to fix this code. Objective of this code is set a range. find the first "To Date", then select all the cells under "To Date" paste the value in the previous cells (for example the first "To Date" is in cell F4 contains value from F5:F"N"(N=last row) then paste F5:F"N" values in E5:E"N", then go to the next To Date. The problem I am facing in this code is that the Code does not select the last row in under the "To Date" (except for the first time) the code runs in

VBA compile Error: unexpected error 35010

随声附和 提交于 2021-01-29 05:00:12
问题 I am trying to compile a big project in Excel however the unexpected error is showing up often but not always. One engineer told me that it is related to virtual memory. Can anyone please tell what should I do to eliminate this issue? Thank you! 回答1: In my case this happened unexpectedly, the project was not particularly large. Closing the VBA host and reopening allowed the project to compile. To fix this I'd suggest trying the simplest fixes before heading over to Advanced System Settings...

VBA compile Error: unexpected error 35010

流过昼夜 提交于 2021-01-29 04:57:30
问题 I am trying to compile a big project in Excel however the unexpected error is showing up often but not always. One engineer told me that it is related to virtual memory. Can anyone please tell what should I do to eliminate this issue? Thank you! 回答1: In my case this happened unexpectedly, the project was not particularly large. Closing the VBA host and reopening allowed the project to compile. To fix this I'd suggest trying the simplest fixes before heading over to Advanced System Settings...

Compare Products use multiple properties

自闭症网瘾萝莉.ら 提交于 2021-01-28 06:04:35
问题 I have an Excelsheet and want to compare the products by multiple values. My Excel looks like this: +-----------+--------+------+-------+---------+-------+ | Name| kcal | Fat | Carbs | Protein | €/kg | +-----------+--------+------+-------+---------+-------+ | Product A | 383,00 | 5,90 | 6,50 | 76,00 | 21,98 | | Product B | 359,00 | 0,70 | 3,20 | 85,00 | 24,90 | | Product C | 380,90 | 5,86 | 8,79 | 73,25 | 32,17 | | Product D | 390,00 | 5,50 | 5,30 | 80,00 | 18,96 | +-----------+--------+-----