+ Reply to Thread
Results 1 to 5 of 5

Code to Locate Numbers and Write Location

  1. #1
    Registered User
    Join Date
    09-09-2018
    Location
    Vancouver, canada
    MS-Off Ver
    2010
    Posts
    76

    Code to Locate Numbers and Write Location

    I need the to locate all the sets of numbers in the cell range E2:E20 (I will need to be able to add additional ranges, this is only an example). Using my sample Excel sheet the first number found in the range (1-1 located in cell E3) we would use 1 as a reference and write the cell location to the following cells, below (please make the cell location adjustable). Also, if the code finds two sets of numbers (say a 1-7 in cell E5 (not on the Excel sheet) it should write “error” to cell A1 in that case.

    The set of number cells are formatted as text. I searched and searched for existing code and found a close example that possible could be used but just adjusted.

    1 to cell A1
    2 to cell A2
    3 to cell A3
    4 to cell A4
    5 to cell A5
    6 to cell A6
    7 to cell A7
    8 to cell A8
    9 to cell A9
    10 to cell A10

    So using my Excel example sheet 1-1 (in cell E3) would write as cell E3 in cell A1 and 10-2 (cell E9 would write as A10 in cell A10.

    That would do it. Thanks so much for all your help.



    Possible Code?

    Please Login or Register  to view this content.

    LOCATE CELL ADDRESS.png

  2. #2
    Forum Expert
    Join Date
    06-26-2010
    Location
    Austin, TX
    MS-Off Ver
    Excel 2010
    Posts
    1,673

    Re: Code to Locate Numbers and Write Location

    Would this formula work in A1 (and then drag down to A10)?
    =IF(COUNTIF($E$2:$E$20,ROW()&"-*")=0,"",IF(COUNTIF($E$2:$E$20,ROW()&"-*")>1,"error","E"&MATCH(ROW()&"-*",$E$2:$E$20,0)+1))
    Pauley
    --------
    If I helped with your issue, I'd appreciate a rep bump (hit the '*' icon to the bottom left of this post).

  3. #3
    Registered User
    Join Date
    09-09-2018
    Location
    Vancouver, canada
    MS-Off Ver
    2010
    Posts
    76

    Re: Code to Locate Numbers and Write Location

    Hi Pauleyb

    This looks great. I tried it in my day-to-day sheet and it does not work unless I put the formula in A1 (where it is in the sample Excel sheet). The example in the Excel sheet is only a very small example of what I use and so I really have to have a very flexible formulas/VBA code so I can move cell locations within the code/formulas of where the data gets written. Is it possible to place cell locations where it will get written in your formula?

    This would really fit the bill. Thank-you so much.

    Scott

  4. #4
    Registered User
    Join Date
    09-09-2018
    Location
    Vancouver, canada
    MS-Off Ver
    2010
    Posts
    76

    Re: Code to Locate Numbers and Write Location

    Hi

    Are you still there?

  5. #5
    Registered User
    Join Date
    09-09-2018
    Location
    Vancouver, canada
    MS-Off Ver
    2010
    Posts
    76

    Re: Code to Locate Numbers and Write Location

    Could you please close this posting. Reason: my helper is gone.
    Thank-you

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Code to write numbers from one cell to another
    By scott1945 in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 12-02-2018, 05:51 PM
  2. how can i write vba code for replacing continuos fraction numbers in on row
    By baig123 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 06-21-2014, 08:04 AM
  3. Replies: 2
    Last Post: 05-08-2014, 11:33 AM
  4. How can I locate the MAX location?
    By rogerthatman in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-11-2012, 12:06 PM
  5. Locate person and hyperlink to location
    By krabople in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-19-2011, 05:21 AM
  6. Excel 2003: cannot locate default file location
    By Spokaneman in forum Excel General
    Replies: 2
    Last Post: 03-10-2006, 03:20 PM
  7. [SOLVED] locate picture location using macro
    By ME @ Home in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-19-2006, 03:30 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1