named-ranges

Set Excel Named Ranges via C#?

空扰寡人 提交于 2019-12-20 04:25:14
问题 I'm trying to replicate this Access VBA code using C#, but am unable to do so. Wondering if anyone else has tried this before and can help. oWB.Worksheets("Signoff").Range("rgSignOffRecTemplate").Value = g_TemplatePath & "Signoff_Rec.XLT" rgSignOffRecTemplate is a "Defined Name" in the Excel template that I'm trying to write to. Many thanks for your help. 回答1: private void ThisWorkbook_Startup(object sender, System.EventArgs e) { Excel.Name oName; Excel.Range oRange; //'using name oName =

getRange with named range google spreadsheet using scripts

旧时模样 提交于 2019-12-18 15:04:08
问题 Can the getRange be used to have a named range instead of an area? When I seem to do it, it says the argument must be a range. For example, Instead of: getRange("A4:E7"); The area of A4:E7 has been made into a named range called 'Names' in sheet1. Could you perhaps use: var tableRange = SpreadsheetApp.getActiveSpreadsheet();.getRangeByName("Names"); getRange(tableRange); Or is there any other way of doing it. The full code is: function onEdit(event){ var ss = SpreadsheetApp

Excel OFFSET function error when using TREND in reference

匆匆过客 提交于 2019-12-13 03:36:04
问题 Consider an Excel sheet with the following values: A B -------- 1| 1 5 2| 2 8 3| 3 11 Entering the array formula =TREND(B1:B3,A1:A3,A1:A3) in cells C1:C3 returns {5;8;11} , as expected. Entering =OFFSET(C1:C3,1,0) returns {8;11;0} , also as expected. However, if I try entering =ROWS(OFFSET(TREND(B1:B3,A1:A3,A1:A3),1,0)) , I get the message, "The formula you typed contains an error". I can't do anything to get it to accept the formula. Next I created the named ranges "TrendRange" and

VBA Referencing Named Range

梦想的初衷 提交于 2019-12-13 03:03:18
问题 I have defined a named using the following code: ActiveWorkbook.ActiveSheet.Names.Add Name:="BCLabel", RefersToR1C1:= _ "=OFFSET(R46C3,1,0,COUNTA(R46C3:R69C3)-2)" ActiveWorkbook.ActiveSheet.Names("BCLabel").Comment = "" This code repeats for several worksheets, such that I have many named ranges titled BCLabel, although this refers to different ranges. For example =OFFSET('January'!$C$46,1,0,COUNTA('January'!$C$46:$C$69)-2) =OFFSET('February'!$C$46,1,0,COUNTA('February'!$C$46:$C$69)-2)

Cannot vlookup range after name change in VBA

此生再无相见时 提交于 2019-12-13 02:48:13
问题 Apologies if this has been asked a different way but I couldn't find this issue anywhere... I am creating a model to analyse test data and need to vary the size of my named ranges regularly, to account for the different number of learners on each course. I have used the following code to do this: For i = 2 To 20 With ActiveWorkbook.Names("Question" & i) .RefersTo = "Pivot Data 1 - To Use!$A$" & QuestionStart & ":$F$" & (LearnerNumbers + QuestionStart) .Visible = True End With QuestionStart =

Is it possible to assign conditional formatting to a named range in Google Sheets?

℡╲_俬逩灬. 提交于 2019-12-12 16:06:14
问题 I'd like to apply a conditional formatting rule to a named range. Is that even possible? How do I do that? When trying to enter the Name of the Range to the Field where you set up the range the rule applies to it won't accept my input. Also with INDIRECT it does not work: 回答1: this is not possible in Google Sheets for the custom formula you need to wrap it into INDIRECT formula like: 回答2: I think it is not possible, it is not documented in official docs. Range names: Can contain only letters,

Excel - Create chart from range of cells while excluding null values?

佐手、 提交于 2019-12-12 14:37:54
问题 I've got this Excel sheet which basically contains a lot of data. Now, this Excel sheet is updated dynamically via a macro that imports the data. So the data might change, meaning, some cells might be populated, while others won't. So I've got this formula in Sheet 2 in each cell from A2:A60 to M2:M60 which basically looks like this: =IF(Sheet1!E2<>0;Sheet1!A2;"") Meaning, if cell E2 on the row I'm in is 0, then the copied value in the new spreadsheet is nothing. Same goes for the next row:

How to OFFSET from a dynamic named range and use that range in SUMPRODUCT?

痴心易碎 提交于 2019-12-12 11:19:31
问题 Situation: I am getting #Value! when trying to pass the OFFSET of a dynamic named range to SUMPRODUCT . Setup: I have the following data in range A2:B4 of Sheet1. | TextA | 1 | |-------|---| | TextA | 2 | |-------|---| | TextB | 3 | I have created a dynamic named range, textRange , of the values in column A with the formula: =OFFSET(Sheet1!$A$2,0,0,COUNTA(Sheet1!$A$2:$A$1048576),1) As shown in image: Note: textRange will pick up all required rows. It can be assumed to be pulled from a

Get sheet name from a named range's Name object

你说的曾经没有我的故事 提交于 2019-12-12 10:38:55
问题 I have: Microsoft.Office.Interop.Excel.Workbook wb; Microsoft.Office.Interop.Excel.Name name; Is there any way to get the worksheet name that the named range is on in the given workbook, assuming I've gotten the named range's Name object and wb already? 回答1: Yes, use the Parent property to work your way up the object hierarchy: ws = name.RefersToRange.Parent.name; 回答2: Range.Worksheet is a self-documenting alternative to Range.Parent : string wsName = name.RefersToRange.Worksheet.Name; (Or in

Excel VBA copy pasting each named range to word

让人想犯罪 __ 提交于 2019-12-12 05:23:28
问题 I have dynamic named range of cell. I need to paste each named range in one page of word and move to next page for next named range. I tried copule of code, I am unable to do.Each named range data is overlapping each other. Can anyone help me, please. Set wbBook = ActiveWorkbook Set rs = wbBook.Names(1).RefersToRange For i = 2 To wbBook.Names.Count Set rs = Union(rs, wbBook.Names(i).RefersToRange) Next rs.Copy With wd.Range .Collapse Direction:=0 .InsertParagraphAfter .Collapse Direction:=0