【发布时间】:2019-11-22 09:10:17
【问题描述】:
一旦我通过 for 循环确定了一个感兴趣的单元格,我如何才能从包含所述感兴趣的单元格的整个表格行中创建一个范围? 我只需要我较大代码的一小部分的帮助。
'TransColumn is a table column in which I am looking for the phrase "NPD".
'TransCell is my cell of interest, containing the phrase "NPD".
'I want Trans_Queue_Row to be the table row in which TransCell is located.
For Each TransCell In TransColumn
If InStr(1, TransCell.Value, "NPD") > 0 Then
Dim Trans_Queue_Row As Range
Set Trans_Queue_Row = ThisWorkbook.Sheets("Project Queue").ListObjects("TableQueue").ListRows
'I know this looks like a weird way to achieve what I'm asking for, but I'm using InStr to support some other elements of my code not displayed here.
我想要一个变量(即 - Trans_Queue_Row)来标识包含 TransCell 的整个表格行。
【问题讨论】:
-
我已经在你之前的问题中回答了这个问题 - stackoverflow.com/questions/56996550/…
-
我已经进一步开发了我的工作簿所需的功能(自上一个问题以来)。我现在意识到我不能简单地从源表中复制整行并将其全部粘贴到目标表中。相反,我需要识别源行中的特定列位置并将它们映射到目标行中的特定列位置。源行的具体列位置可能与目标行的不同。所以我想首先确定源行(根据这个问题),然后在它们之间映射所需的相应列位置。
-
@TimWilliams 我在您之前的回复中看到您为源表、目标表、源列和目标行提供了变量。我看不到在哪里为源行创建了任何变量。对不起,如果我错过了。我需要创建一个源行变量。
标签: excel vba row listobject