あなたがstatus
を見つけた後は、あなたのVLookup
を通じて、あなたは値が検出されたVLookup
範囲を検索するFind
機能を使用することができます。
私は2つのRange
変数、VLookup
範囲についてRng
、およびFind
ためRngFind
を追加しました。
コード
Private Sub CommandButton6_Click()
Dim status As Variant
Dim Rng As Range
Dim RngFind As Range
Set Rng = Sheets("bestand totaal").Range("J2:W9996")
status = WorksheetFunction.VLookup((Sheets("Gegevens").Range("B3").Value), Rng, 14, False)
Set RngFind = Rng.Find(What:=status, LookIn:=xlValues, Lookat:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True)
RngFind.Parent.Activate ' activate the worksheet, in case the VLookup Range is not the active sheet
RngFind.Select ' select the range (cell) where Find was set to true
End Sub
後、私はあなたが求めているのかわからないんだけどね。コードが「特定の範囲に移動」ではなく、vlookup値を返すように見えます。 ---達成しようとしていることは何ですか? –