excel-2010

Offset function returns #VALUE! with small dataset

大城市里の小女人 提交于 2019-12-24 03:20:27
问题 I have some data in excel and want to access certain rows with the offset function, however the function returns #VALUE! for my small dataset. Using this, OFFSET(A2;0;0;COUNTA(A2:A99999);1) I get #VALUE! . When changing the formula to OFFSET(A2;0;0;100;1) I get a value. Any suggestions, what I am doing wrong? I appreciate your replies! 回答1: If =OFFSET(A2;0;0;COUNTA(A2:A99999);1) is your full formula you are getting a result with a hard-coded number due to Inferred Position (I hope that's the

Group rows by value

僤鯓⒐⒋嵵緔 提交于 2019-12-24 02:14:13
问题 How to programmatically group following data by values in column B ? Note, that there are random values in columns A and C . Like this: --> 回答1: Try this Sub demo() Dim r As Range Dim v As Variant Dim i As Long, j As Long With ActiveSheet On Error Resume Next ' expand all groups on sheet .Outline.ShowLevels RowLevels:=8 ' remove any existing groups .Rows.Ungroup On Error GoTo 0 Set r = .Range("B1", .Cells(.Rows.Count, 2).End(xlUp)) End With With r 'identify common groups in column B j = 1 v =

Calling Private Macros / UDFs From Another Workbook (Add-In)

人盡茶涼 提交于 2019-12-24 01:27:07
问题 This is a follow-up question for my previous question: How Can I Prevent The Suggestion of Custom VBA Functions When Writing Formulas in Excel? I have implemented the suggestions made in the answer given in order to make my macros and UDFs private, in a way which allows them to be called within other modules in the same workbook but prevents them from being suggested when writing formulas. I'm trying to produce an Add-In which contains reusable macros and UDFs, and in other VBA projects I am

conditional formatting entire row if cell contains text

时间秒杀一切 提交于 2019-12-23 20:36:13
问题 I have an excel sheet where I'm trying to use conditional formatting but it doesn't seem to work as I would like it to. It seems as though any formula won't work as I don't want the cell to match TBC, but contain it. In short, I am looking for this: If D2 Contains "TBC" then highlight the whole row I've tried around 10 suggestions through Google and also Stack Overflow but it seems as thou Note: Each cell will have different values, i.e. D2 has "1 screenshot TBC" and D3 has "5 screenshots TBC

Change Path to Picture Links in Excel

你。 提交于 2019-12-23 18:29:13
问题 I have manually pasted a large number of linked pictures into a 2010 Excel spreadsheet using insert picture -> select picture location --> link to file. These pictures are part of a report. I update the pictures using R each quarter, and my report automatically updates. Perfect. I now need to change the directory where the plots are kept, and need to update the links. As there are around 200 of them (its a big report), I want to do this in VBA. Whilst I can loop through the pictures ok

Simple HLOOKUP Failing with Excel 2010

a 夏天 提交于 2019-12-23 18:20:16
问题 I have an Excel spreadsheet (generated by spreadsheet gear, but it's more an Excel problem) that isn't functioning as i would expect when I use HLOOKUPS. I use a simple HLOOKUP to look up the value at a given percent in a table. For two certain values, the HLOOKUP fails. These values are 0.9993 and 0.999. This excel document demonstrates the problem: http://dsokol.com/tokio/excelna.xlsx. Cells C6 and C7 are showing as N/A, when they are intended to be populated with B and C. If I re-key over

Formula to conditional formatting text that contains value from another cell

China☆狼群 提交于 2019-12-23 17:52:59
问题 I have a column A that contains a 1-4 word phrases in each cell. I also have 4 cells that contain 1 word values: B1 C1 D1 and E1 I need to setup conditional formatting is such a way, that: 1) If text in a cell from column A contains a word that matches value from ONE of the cells mentioned above, highlight that cell (from column A) in red. 2) If text in a cell from column A contains words that matches value from TWO of the cells mentioned above, highlight that cell (from column A) in blue. 3)

WorksheetFunction array size limit

心已入冬 提交于 2019-12-23 16:42:20
问题 I'm trying to calculate the 99.5% percentile for a data set of 100000 values in an array (arr1) within VBA using the percentile function as follows: Pctile = Application.WorksheetFunction.Percentile(arr1, 0.995) Pctile = Application.WorksheetFunction.Percentile_Inc(arr1, 0.995) Neither works and I keep getting a type mismatch (13). The code runs fine if I limit the array size up to a maximum of 65536. As far as I was aware calculation limited by available memory since Excel 2007 array sizes

Remove all formatting of the table created from InsertTable method in ClosedXML

一笑奈何 提交于 2019-12-23 16:17:10
问题 I'm using ClosedXML to generate a report. The data supplied to Excel is from a database which is stored to a DataTable object. The table is displayed fine in the Excel sheet - however, it has a default theme applied on the created table. Below is my sample code: Dim workbook As XLWorkbook = New XLWorkbook() Dim _tempSummary= workbook.AddWorksheet("Summary").Cell(1, 1).InsertTable(tblSummary) This is the result: I wanted to remove the bold font styling of the created table. However, when I did

Delete all existing excel chart series

别说谁变了你拦得住时间么 提交于 2019-12-23 16:17:06
问题 I am modifying a line chart in excel and I want to remove all the series and add new series to the same chart. I am using the foll code: Excel.SeriesCollection serColl = chartpage.SeriesCollection(); Excel.Series ser = serColl.Item(4); ser.Delete(); ser = serColl.Item(3); ser.Delete(); ser = serColl.Item(2); ser.Delete(); ser = serColl.Item(1); ser.Delete(); But I wanted the code to be generic i.e. find the number of series and delete all in a loop. Thanks in advance. 回答1: Like so. Excel