Hey guys,
I'm having difficulties with this code:
Sub Prueba2()
Dim art_name As String
Dim stockref As Integer
Dim sale As Integer
Dim stock As Integer
Set salerange = Range("C:D")
art_name = Range("S4").Value
stockref = Range("T4").Value
sale = Range("U4").Value
stock = Application.WorksheetFunction.VLookup(art_name, salerange, 2, False)
stock = stockref - sale
Range("stock").Value = stock
End Sub
My problem is that I am trying to place the value of "stock" in the corresponding range that is in refrence to art_name. I know that my issue lies here: "Range("stock").Value = stock". I'm guessing that I have to locate the function in my table range.... or something.
I'm having difficulties with this code:
Sub Prueba2()
Dim art_name As String
Dim stockref As Integer
Dim sale As Integer
Dim stock As Integer
Set salerange = Range("C:D")
art_name = Range("S4").Value
stockref = Range("T4").Value
sale = Range("U4").Value
stock = Application.WorksheetFunction.VLookup(art_name, salerange, 2, False)
stock = stockref - sale
Range("stock").Value = stock
End Sub
My problem is that I am trying to place the value of "stock" in the corresponding range that is in refrence to art_name. I know that my issue lies here: "Range("stock").Value = stock". I'm guessing that I have to locate the function in my table range.... or something.