+ Reply to Thread
Results 1 to 10 of 10

Selecting adjacent cell?

  1. #1
    Registered User
    Join Date
    07-18-2011
    Location
    NH, USA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Selecting adjacent cell?

    Hi all,

    I am writing a function that goes through a list and returns the number that is nearest to a specified number. The part that I need help with is that I would then like to find a way to select the cell that is a column over from that "nearest number" cell. How would I go about doing this?

    Thanks!
    Last edited by tapoore; 07-19-2011 at 03:48 PM.

  2. #2
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Selecting adjacent cell?

    Where is "over" from the nearest number? Left, right, up, down? Can you provide the code to your function?
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  3. #3
    Registered User
    Join Date
    07-18-2011
    Location
    NH, USA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Selecting adjacent cell?

    Here is what I started with - Credit to Yogesh Gupta
    Please Login or Register  to view this content.

    In this case, "over" would mean the cell to the left of where the function find the "nearest" number.

  4. #4
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Selecting adjacent cell?

    Hi

    Welcome to the forum ....

    You would do best to post a sample workbook showing your Sheet Layout and perhaps Before and After examples.

    It should clearly illustrate your problem and not contain any sensitive data.

    Cheers

    From Forum FAQs

    How do I attach a file to a post?

    To attach a file to your post, you need to be using the main 'New Post' or 'New Thread' page and not 'Quick Reply'. To use the main 'New Post' page, click the 'Post Reply' button in the relevant thread.

    On this page, below the message box, you will find a button labelled 'Manage Attachments'. Clicking this button will open a new window for uploading attachments. You can upload an attachment either from your computer or from another URL by using the appropriate box on this page. Alternatively you can click the Attachment Icon to open this page.

    To upload a file from your computer, click the 'Browse' button and locate the file. To upload a file from another URL, enter the full URL for the file in the second box on this page. Once you have completed one of the boxes, click 'Upload'.

    Once the upload is completed the file name will appear below the input boxes in this window. You can then close the window to return to the new post screen.
    If this isn't possible then PM Yogesh Gupta

  5. #5
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,256

    Re: Selecting adjacent cell?

    Are you using this function in a worksheet? If so, you cannot have it select a cell.
    Remember what the dormouse said
    Feed your head

  6. #6
    Registered User
    Join Date
    07-18-2011
    Location
    NH, USA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Selecting adjacent cell?

    Hi all,

    Thanks for your thoughts so far. I have attached a sample spreadsheet showing what I'm trying to do. Please let me know if you need any more information.
    Attached Files Attached Files

  7. #7
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,256

    Re: Selecting adjacent cell?

    Still not clear to me what is missing. (as I said you cannot actually select a cell from a worksheet function)

  8. #8
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Selecting adjacent cell?

    See if this workbook does as you need, the "good limits", and calcs, are highlighted using conditional formatting.

    I hven't looked at the function you posted, just used the one that you posted with the sample.

    Hope this helps.
    Attached Files Attached Files
    Last edited by Marcol; 07-19-2011 at 11:19 AM.
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  9. #9
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Selecting adjacent cell?

    Given that we are talking about bricks, and the dimensions given suggests building bricks (clay?).

    I would be surprised if a hardness test within a 10mm sample range would be that critical.

    So maybe a simple linear ratio at the cross over point would be accurate enough.

    Try this workbook, no VBa involved.

    Hope this helps.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    07-18-2011
    Location
    NH, USA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Selecting adjacent cell?

    Marcol, your solution was exactly what I needed. Thanks for your help everyone.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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