简体   繁体   English

从具有行值的列中选择单元格

[英]Select cell from column with row value

This simple problem has caused me some recent issues. 这个简单的问题使我最近遇到了一些问题。 I have a range of cells which are columns that hold onto different types of information. 我有一系列单元格,它们是保存不同类型信息的列。 Using a row value (Integer not Range) which is previously determined I am looking to perform a check with the values within a single cell. 使用先前确定的行值(不是整数),我希望对单个单元格中的值进行检查。

For example, I look through a list of names in column A. If the name is found it holds onto the Row value. 例如,我浏览A列中的名称列表。如果找到该名称,它将保留在“行”值上。 Let's assume that the row is 10. This row value will be used in checking the column values for this row (Ie C10, J10, and K10). 假设该行是10。此行值将用于检查该行的列值(即C10,J10和K10)。 How can I select a single cell and then compare the values within those cells? 如何选择一个单元格,然后比较这些单元格中的值?

To get the equivalent to MATCH() / INDEX() or VLOOKUP() in VBA for getting the data for Darth Vader here: 要获得等效于VBA中的 MATCH()/ INDEX()VLOOKUP()的信息,以便在此处获取Darth Vader的数据:

在此处输入图片说明

we could use something like: 我们可以这样使用:

Sub GetTheRowValue()
   Dim RowValue As Long

   RowValue = Range("A:A").Find(What:="Darth Vader", After:=Range("A1")).Row
   MsgBox Range("B" & RowValue).Value
End Sub

The finds the proper row and then acquires data from other columns in that row. 找到合适的行,然后从该行的其他列中获取数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM