![](/img/trans.png)
[英]How do I lock specific cells within a row based on drop down selection in excel
[英]How do I select specific value from Excel table based on a column and row selection?
使用INDEX()
=INDEX($1:$1048676,MATCH("S7",$A:$A,0),MATCH("A20",$1:$1,0))
您可以用單元格引用替換"S7"
和"A20"
的“硬編碼”值,從而使您可以將標題放在這些單元格中以返回正確的值。
這是接受Model和sX值以提供表輸出的代碼,
Sub searchTable()
Dim i As Long, j As Long
sx = InputBox("Enter sX value")
Model = InputBox("Enter the model")
For i = 1 To Cells(Rows.Count, 1).End(xlUp).Row
If Cells(i, 1) = sx Then
Exit For
End If
Next i
For j = 1 To Cells(1, Columns.Count).End(xlToLeft).Column
If Cells(1, j) = Model Then
Exit For
End If
Next j
'This is the value that you need, which can be used somewhere in your program
MsgBox Cells(i, j)
End Sub
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.