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-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
  3. Anonymous
    2023-03-23T15:36:59+00:00

    Jeovany,

    I am trying to use Power Query to pull data off of a PDF and put it in my workbook to add a truck to the inventory. but every time I try and load the data it adds 2 columns that causes the data to not be where I need it to be. Picture below.

    The first picture is the screen before I load the data and the second screen is what happens when I try and load it to cell A4. Am I doing something wrong or is there any way around this?

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2023-03-23T12:39:49+00:00

    Thanks Jeovany,

    I actually got that one figured out a while ago and forgot I had posted that.

    I am however stuck with the question I asked Andreas. Do you know of anyway to do what I am looking for?

    What I really want to do is at the start of my complete macro, open all the workbooks that I will need to make sure they are available to write to them. If one of them doesn't open I want to throw an error saying it didn't open. and stop the code until we can find out who has it open.

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2023-03-23T08:52:34+00:00

    Hi Tim

    Good morning

    From the pictures I would say it is a case of the columns width adjustment

    1st Try by narrowing down the Item description column

    2nd if necessary

    On the layout ribbon tab.>> Paper Margin>> Select Narrow

    Once you do that the PDF macro and print should match.

    Do let me know if you need more help.

    Regards

    Jeovany

    Was this answer helpful?

    0 comments No comments