named-ranges

Excel VBA - ShowAllData method of Worksheet Class failed

心不动则不痛 提交于 2019-12-09 23:14:03
问题 I have automated a proper record input into the table that I use as a database, and when the table is filtered the input don't work. So I have code this to unfilter DataBase before every record input. Public Sub UnFilter_DB() Dim ActiveS As String, CurrScreenUpdate As Boolean CurrScreenUpdate = Application.ScreenUpdating Application.ScreenUpdating = False ActiveS = ActiveSheet.Name Sheets("DB").Activate Sheets("DB").Range("A1").Activate Sheets("DB").ShowAllData DoEvents Sheets(ActiveS)

Creating named range based on value in column

非 Y 不嫁゛ 提交于 2019-12-08 13:48:38
问题 I want to create a named range based on the value of in column B. For example (1, 21, great) (5, 21, sew) (6, 21, test) (7, 22, hi) (1, 21, random) I want to create named range with name: UNIT21, and from the data above the refersto should be A2:C4 and A6:C6. And another named range= UNIT22 for data with 22 in its column B. Problem now is, 1. I don't know how to select the whole row from A:C for respective row. And, 2. how to add new data to existing named range instead of replacing the

Create Named Ranges from Subtotal Group

若如初见. 提交于 2019-12-08 13:07:37
问题 I need to create named ranges from a sheet to which I have added subtotals. So as shown in the picture I need to create with VBA named ranges for all the groups ( E4:F16 shown on the picture). The subtotals are created for each change in Column D ("Group"). The additional rows added by the subtotal wizard ( Row 17 as shown) should not be included in the named range. I need to create about 10 similar named ranges in total. The total number of rows with data on that sheet (I've named it R 14 )

Import named range data between Google Workbooks

流过昼夜 提交于 2019-12-08 07:51:01
问题 If within the same Google Sheets Workbook, the formula: index(namedRangeRow , namedRangeColumn) works beautifully to "pull" or extract the piece of data residing at the intersection of the named row and named column onto another Sheet in the SAME Workbook. How do I write a formula to get the same effect when I want to pull data from a DIFFERENT Workbook? I presume it is importRange, but I can't seem to get that formula to recognize two named ranges and find the data at the intersection

AutoFilter vs ShowAllData

雨燕双飞 提交于 2019-12-07 19:44:29
问题 Background: Since recently I came to know about a secret named range that gets created through using AutoFilter . Usually (if not always) this is called "_FilterDatabase". I thought about playing around with this a little, but then got stuck on the Range object it refers to. Let me explain with the example below: Test data: | Header1 | Header2 | |---------|---------| | 50 | | | 10 | | | 30 | | | 40 | | | 20 | | Test Code: Sub Test() With Sheet1 .Range("A1:B1").AutoFilter 1, ">40" Dim rng As

Populate list box with a named range

只愿长相守 提交于 2019-12-06 05:56:16
I'm working on my first ever VBA project, and need a bit of absolute newbie guidance. I have a submission form that staff will be using to submit their daily KPIs. I have a list box control in a user form called "lstName" that employees will use to select their name before submitting the form Employee names are stored in a named range on "Sheet11" called "EmpName". I want to direct the list box to draw the list of names from the "EmpName" range on Sheet11; but don't know how I would do this in VBA. I was going to use RowSource to point the list box to the data, but I am lost as to how to do

AutoFilter vs ShowAllData

核能气质少年 提交于 2019-12-06 00:26:03
Background: Since recently I came to know about a secret named range that gets created through using AutoFilter . Usually (if not always) this is called "_FilterDatabase". I thought about playing around with this a little, but then got stuck on the Range object it refers to. Let me explain with the example below: Test data: | Header1 | Header2 | |---------|---------| | 50 | | | 10 | | | 30 | | | 40 | | | 20 | | Test Code: Sub Test() With Sheet1 .Range("A1:B1").AutoFilter 1, ">40" Dim rng As Range: Set rng = .Range("_FilterDatabase") If rng.SpecialCells(12).Count > 2 Then rng.Columns(2).Offset

How to join returned values from named range separated by comma

て烟熏妆下的殇ゞ 提交于 2019-12-05 18:52:09
I've spent hours trying to find out how to join returned values from a named range, but the result is a run-time error 32 - Type mismatch. As a newbie I'm still struggling with arrays, so maybe I've overlooked some detail. Thank you for helping me out. Example: (B1)Benzine, (B2)Diesel, (B3)Hybride -> (E1)Gasoline, (E2)Diesel, (E3)Hybrid This is the named range: Another example (to be more clear): Example 2: (B1)Benzine, (B3)Hybride -> (E1)Gasoline, (E3)Hybrid Option Explicit Sub splitter() Dim i As Long Dim w As Long 'Dim oWB As Workbook Dim oWS As Worksheet Dim oWS9 As Worksheet Dim rngMOTOR

Excel VBA - ShowAllData method of Worksheet Class failed

非 Y 不嫁゛ 提交于 2019-12-04 19:59:33
I have automated a proper record input into the table that I use as a database, and when the table is filtered the input don't work. So I have code this to unfilter DataBase before every record input. Public Sub UnFilter_DB() Dim ActiveS As String, CurrScreenUpdate As Boolean CurrScreenUpdate = Application.ScreenUpdating Application.ScreenUpdating = False ActiveS = ActiveSheet.Name Sheets("DB").Activate Sheets("DB").Range("A1").Activate Sheets("DB").ShowAllData DoEvents Sheets(ActiveS).Activate Application.ScreenUpdating = CurrScreenUpdate End Sub But now, it stays stuck on Sheets("DB")

Google spreadsheet - Error when Remove range protection

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 15:33:08
Here's my script, but I can't get it to work for some weird reason??!!! Driving me nuts. function removeThenSetProtection() { // Remove all range protections in the spreadsheet that the user has //permission to edit. var ss = SpreadsheetApp.getActive(); var protections = ss.getProtections(SpreadsheetApp.ProtectionType.SHEET); for (var i = 0; i < protections.length; i++) { var protection = protections[i]; if (protection.canEdit()) { protection.remove(); } } } Change: var protections = ss.getProtections(SpreadsheetApp.ProtectionType.RANGE); To: var protections = ss.getProtections(SpreadsheetApp