こんばんは!あちこち探し回っていたのですが、残念ながら完全に逆方向のものを手に入れてしまいました (私は Excel/VBA についてあまり詳しくなく、可能な限り最も難しい方法ですべてを行っていると 99% 確信しています)。私がやろうとしているのは、別のシートから値を見つけて変更することです。
For i = SORowStart To SORowEnd
'Grabbing this information PID and QTY from my main sheet.
ProductID = Range("B" & i).Value
ProductQty = Range("A" & i).Value
'I then need to match up PID on another sheet, and modify its Qty
If (Len(ProductID) > 0) Then
'Finding old quantity, successfully..but how do I change it??
OldQty = Application.WorksheetFunction.VLookup(ProductID, Worksheets("Inventory").Range("List_InventoryTable"), 4, False)
'MsgBox (ProductID & " - SELLING:" & ProductQty & "/" & OldQty)
'SO HERES MY PROBLEM LINE! ****************************
'I've tried with and without the "Set" keyword too.
'Set Application.WorksheetFunction.VLookup(ProductID, Worksheets("Inventory").Range("List_InventoryTable"), 4, False).Value = (OldQty - ProductQty)
End If
次は
誰かが私を正しい方向に向けたり、検索するキーワードを教えてくれたりしたら、何でも信じられないほど役に立ちます...私はこれに何時間も悩まされてきました - _ - OldQty のアドレスを見つけようとしましたセル、しかし成功しません。Excel セル数式内で (=ADDRESS と =MATCH (?) を使用して) 実行できるようですが、VBA 内で実行する手がかりがありません。読んでくれてありがとう :)