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: Newest
  1. Anonymous
    2023-02-21T12:32:40+00:00

    Hi Tim

    Good morning

    I was expecting finishing my morning appointment earlier (before1pm local time). Unfortunately we have some delays here.

    Let's meet up later in the day.

    What about 5pm London time I.e 12 pm your local time.

    See you soon

    Regards

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2023-02-20T19:08:51+00:00

    Here is the link to the current files.

    https://we.tl/t-5mgWQCjlG1

    I will be happy to talk with you tomorrow. I believe you are 5 hours ahead of me would you possibly be able to meet at 1:30 London time?

    That's great

    Thanks Tim

    I'll post the link tomorrow with time enough before our meeting

    Regards

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2023-02-20T17:03:24+00:00

    Here is the link to the current files.

    https://we.tl/t-5mgWQCjlG1

    I made a few adjustments to the invoice already in an attempt to automate the invoice #. I am still looking at Andreas code. However I can already see that you are both much more advanced then myself. I suspect I am not going to fully understand what he has written.

    I will be happy to talk with you tomorrow. I believe you are 5 hours ahead of me would you possibly be able to meet at 1:30 London time?

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2023-02-20T14:58:48+00:00

    Thank you Tim, for accepting the video call/ meeting.

    Yet, I would strongly suggest focusing on the Tables structure, the Data cleansing, and getting a more reliable SKU/CODE/Product IDs for all the products in the store, because after our meeting you might have to change or create the macros again.

    Please., it would be a great advantage if you share with us, before our meeting., the latest version of the files involved in this project. Our answers will depend on that too.

    Do let us know when you ready.

    Regards

    Jeovany

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2023-02-20T13:56:40+00:00

    Jeovany and Andreas,

    Thank you very much for all the help. I am definitely aware that the scope of my project has vastly increased the more I get into it. I appreciate you being willing to do a video chat with me to discuss this. I would however like to ask if we can wait on that call for a little bit. I have written a code that works when I make sure the information is correct. However I do understand what Andreas is saying about trying to "break" the process with bad information. I would like to look at the code he wrote and make sure I understand it before moving forward. I have also already moved forward with combining all of the inventory into 1 file, but need to work on adjusting the pages my employees use to check on the inventory to read the centralized inventory page. Again thank both for all the help. I am going to work on makin alot of the changes that the two of you have suggested and cleaning thing up at this time. I hope you would still both be open to me asking questions in this thread as I come across them.

    Thank you

    Tim

    Was this answer helpful?

    0 comments No comments