Consulting

Results 1 to 3 of 3

Thread: Search for Numbers

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Search for Numbers

    Hi


    I’m looking for help to develop code to find numbers on my Excel sheet and then write the results. I’ll be using it with other code so I can not use a formula.


    I have already posted this request but did not get the code I need at: https://www.excelforum.com/excel-pro...r-numbers.html.
    I really have to have the search cells hard coded so I can add new ranges later on.


    Details:


    - Project1 is the sheet code name.
    - The search range cells and the write cells are formatted as number.
    - I can only use hard code for the search range and write cell range. There will never be a change in cell location or sheet name.


    The code searches cell ranges E3:E14, H3:H14 (and other ranges to be added in the future) to locate numbers from 1 to 12 but a positive result would only occur if data is present in the adjacent cell to the right of any number 1to 12. A lot of cells with numbers 1 to 12 will have no data in them (in the adjacent cell to the right) so that would be a negative result. When this condition is met the code would then search cell range A3:A14, which has the number 1 in cell A3 all the way to 12 in cell A14 for the found number and write the found number in the adjacent cell to the right of it. There will always be found numbers. If the code finds two of the same numbers could it write “err” or something similar in the cell range B3:B14.


    Examples and expected results


    The first found number would be 3 in cell E5 and would be a positive result because there is data in cell F5. Using the found number 3, the code would then search the range A3:A14 for the number 3, cell A5, and then write 3 in the cell to the right of it B5. The second example is cell E9 with a 7 in it and has data in cell F9 so the code would write 7 in cell B9. Same for the third example in cell H11.


    Thanks for all your help.

    fins numbers.jpg
    Attached Files Attached Files

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •