listobject

Looping through rows in a ListObject to delete them is very slow

ⅰ亾dé卋堺 提交于 2020-01-04 05:02:08
问题 I have a ListObject table with ~500 rows, I've also got 4 values in a named range. There are maybe 30 unique values that occur repeatedly (At random) for the 500 rows, I want to delete all rows whose values are not in the named range. I have the following which works, but it is running slower than expected (approximately 2 min): Sub removeAccounts() Dim tbl As ListObject Dim i As Integer Set tbl = ThisWorkbook.Sheets("TheSheet").ListObjects("TheTable") i = tbl.ListRows.Count While i > 0 If

Trouble pasting row to table

匆匆过客 提交于 2019-12-31 05:30:07
问题 For every cell that is not blank in column "Transition" of table "TableQueue", I want to: 1)Copy from table "TableQueue" the entire table row that contains that cell, 2)Paste that row to the bottom of table "TableNPD", 3)Delete the row from table "TableQueue" I've gotten everything except the copy/paste/delete to work. See my note halfway down the code below to see where my problem begins. I am new to vba and, although I can find plenty of info on copying and pasting to the bottom of a table,

Paste data - ranges of Listobjects in other Listobject of Excel

元气小坏坏 提交于 2019-12-24 09:19:10
问题 I am using VBA to move data between tables in excel (ListObjects) And I want to avoid loops for they are too much time consuming I have a first (origin) table called:tabl1 and a second origin table: tbl2 I have a destiny table called:tbl3 this table is empty, so databodyrange is nothing I would like to paste data from the two origin tables tbl1 and tbl2 into tbl3 Dim tbl1 As ListObject Dim tbl2 As ListObject Dim tbl3 As ListObject Set tbl1 = ThisWorkbook.Sheets(1).ListObjects("table1") Set

How to read formulas of Calculated Columns in an Excel Table/ListObject without any data rows

强颜欢笑 提交于 2019-12-22 08:47:39
问题 I have a ListObject with an external query as the data source, which returns 18 columns. The ListObject has previously had an additional 4 calculated columns added. Right now, the ListObject has 0 data rows, however, while there are 0 data rows, I don't seem to be able to read the pre-defined formulas of the calculated columns. If I refresh the data source, and the data source returns at least 1 row, then the formulas for the calculated columns become readable. Likewise, if I manually enter

Excel 2010, VBA and ListObjects subtotals not updating on Table changes

时光毁灭记忆、已成空白 提交于 2019-12-22 05:06:23
问题 So, having this structure (starting at A1 - show snippet > run): table { border-color: #BBB; border-width: 0px 0px 1px 1px; border-style: dotted; } body { font: 12px Arial, Tahoma, Helvetica, FreeSans, sans-serif; color: #333; } td { border-color: #BBB; border-width: 1px 1px 0px 0px; border-style: dotted; padding: 3px; } <table> <tbody> <tr> <th></th> <th>A</th> <th>B</th> <th>C</th> <th>D</th> </tr> <tr> <td>1</td> <td>Title 1</td> <td>Title 2</td> <td>Title 3</td> <td>Title 4</td> </tr> <tr

Excel VBA ListRows.Add Fails

不羁岁月 提交于 2019-12-18 09:43:20
问题 I'm probably missing something simple, but ListRows.Add is giving me grief. Here's the function: Sub addEmployee(employeeName As String, tableToAddTo As ListObject) Dim newRow As ListRow Set newRow = tableToAddTo.ListRows.Add() newRow.Range.Cells(1, 1).Value = employeeName tableToAddTo.Sort.Apply End Sub In most cases, this works fine. However, whenever the function runs on a certain table in my worksheet, the lines following the call to ListRows.Add are never executed (at least that's what

Add/Modify/delete calculated column formula in Excel Listobject/Table via VBA

巧了我就是萌 提交于 2019-12-17 16:39:13
问题 If I manually enter a formula into a column in an Excel table (i.e. ListObject), AutoCorrect applies this formula to the whole column. Is there any way to control the this behavior via VBA, i.e. can I somehow modify/delete/add this formula? I know I can simply change the formula of the ListObject.ListColumns(1).DataBodyRange object - but this will overwrite any manually values entered before - while changing the formula in the UI will leave this untouched... 回答1: Thanks to Doug's and

Open and Fetch data from a ListObject of an Excel sheet with Python

白昼怎懂夜的黑 提交于 2019-12-13 19:12:34
问题 The Problem: Open a ListObject (excel table) of an Excel file from y python environment. The why: There are multiple solutions to open an excel file in python. Starting with pandas: import pandas as pd mysheetName="sheet1" df = pd.read_excel(io=file_name, sheet_name=mysheetName) This will pass the sheet1 into a pandas data frame. So far so good. Other more detailed solution is using specific libraries. This one being a code of a stack overflow question. from openpyxl import load_workbook wb2

How can I remove duplication of 2 separate which is interrelated with each other (PYTHON)

≯℡__Kan透↙ 提交于 2019-12-13 08:16:22
问题 After reading so many title, I couldn't solved the problem below. Does anyone can help me please ? For instance, I have 2 list (list_I and list_II) which is interrelated with each other. list_I = [123, 453, 444, 555, 123, 444] list_II = [A, A, B, C, A, B] What I hope to get is: New_list_I = [123, 453, 444, 555] New_list_II = [A , A, B, C] I use these two list as a body part of e-mail. That's why I need 2 separate (but on the other hand interrelated) list. I'm able to send an e-mail right now.

Passing Listobject Range to array and getting error “out of range”

前提是你 提交于 2019-12-13 03:47:17
问题 In order to increase speed of my code when looping thought values of a datarange of a Listobject I want to pass the values of a column to an array and loop through the array instead of looping throught the values of the Listobject. I got an insight here From there I elaborated this code. 'passing the list object to a variable Dim SCtbl As ListObject Set SCtbl = ThisWorkbook.Worksheets("sc").ListObjects(1) 'dimensioning the array (as variant) Dim ListofSC As Variant ListofSC = SCtbl