Using the find In VBA

Anonymous
2023-02-09T14:01:31+00:00

I am trying to write a macro that will deduct an item from my stock (which is housed in a different workbook) when I hit the complete button. My thoughts were to use the find function, activate the cell, and then subtract the quantity from the active cell. I am just starting with the macro, but I am running into an object error with my find.

Sub Deduct()

Dim C As String

'Deduct the Quantity from Stock

Workbooks.Open "C:\Users\furnd\Desktop\Test Deduct.xlsm"

With Workbooks("Test Deduct.xlsm").Sheets("Sheet1").Range("A1:A2000")

Set C = .Find(What:="A1").Value

End With

Workbooks("Test Deduct.xlsm").Activate

Sheets("Sheet1").Select

C.Offset(0, 1).Select

End Sub

Microsoft 365 and Office | Excel | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

47 answers

Sort by: Most helpful
  1. Anonymous
    2023-05-23T19:50:09+00:00

    Hi Tim

    Welcome back!

    I'm glad to know your project is coming to fruition. As for the help, we all have been happy to assist you.

    Do not hesitate to ask more or new questions

    Kind regards

    Jeovany

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2023-05-23T18:45:32+00:00

    Jeovany

    It has been a little while since I asked any questions, but I just wanted to say thank you for all the help on this project. I am currently finishing it up. I have been testing it for about the last 2 to 3 weeks and everything seems to be working well. I would not have been able to complete it with out all of the help you provided.

    Was this answer helpful?

    0 comments No comments