+ Reply to Thread
Results 1 to 3 of 3

VBA: Find the adress of the cell within a certain row with the value closest to 1

  1. #1
    Registered User
    Join Date
    07-21-2014
    Location
    Netherlands
    MS-Off Ver
    2010
    Posts
    2

    VBA: Find the adress of the cell within a certain row with the value closest to 1

    Hi all!

    This is my very first post here, I am very new at VBA. I am looking forward to be of service to this community, so I can enhance my own VBA skills.

    However I have now run into a problem which I cannot seem to be able to solve:

    At my work we print the times of people coming in and out. The times can be anywhere from 0:00 to 23:59 as most of you probably know the times are saved in excel as an number (double) between 0 and 1.

    I want to know the adress of the cell which is closest to 23:59 (seen by excel as value 1).

    example:
    19:45 21:46 22:02 23:47 00:02 01:44 01:59 03:45

    I hope you can help me!

    With Kind regards,

    MrBengek

  2. #2
    Registered User
    Join Date
    07-21-2014
    Location
    Netherlands
    MS-Off Ver
    2010
    Posts
    2

    Re: VBA: Find the adress of the cell within a certain row with the value closest to 1

    This is what I currently have, it works as intended maybe usefull for the next person. (my data is in column 11 - max column count)
    and reports the column which is closest to 1

    Please Login or Register  to view this content.

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: VBA: Find the adress of the cell within a certain row with the value closest to 1

    I would think you can do it without looping. The MAX function will present the highest value in the range, which should the value you're looking for. Then you can jump straight to that value with a FIND command and create the address.

    Here it is in one line of code:

    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ 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. Find cell with the last closest date
    By Chiefsotos in forum Excel General
    Replies: 8
    Last Post: 04-13-2014, 04:09 PM
  2. find closest cell on left & right
    By freeurmind in forum Excel General
    Replies: 3
    Last Post: 07-01-2013, 11:02 AM
  3. [SOLVED] How do I find the adress that shares the column of a certain cell and row of another?
    By groznij in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-10-2012, 08:22 PM
  4. [SOLVED] find values and identifying cell-adress
    By anderssweden in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-14-2006, 06:42 AM
  5. [SOLVED] VBA: Find and adress cell
    By Maria in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-17-2005, 01:06 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