Results 1 to 5 of 5

find exact or immediate inferior date

Threaded View

  1. #1
    Registered User
    Join Date
    10-22-2020
    Location
    Canada
    MS-Off Ver
    2013
    Posts
    7

    find exact or immediate inferior date

    Hi everybody!

    Second post here, i think i need some help..

    I have a sheet that many users use to create TASK for vehicles. Those task should be created in order of "Starting date of the task".

    I've been able to find and create the task template under a task with the SAME date, i can't find a way to select the closest inferior date…

    Here's the code i use to find the SAME date:

     Dim findDate As Date
     Dim findStr As String
     Dim R As Range, WS As Worksheet
    
     Set findDate = TxtDateDebut 'This is from a TextBox in a UserForm
     Set WS = Worksheets("TĀCHES")
    
     findStr = Format(TxtDateDebut, "DD/MM/YYYY")
    
     MsgBox TxtDateDebut
    
     With WS
    
     Set R = .Cells.Find(what:=findStr, LookIn:=xlValues, lookat:=xlWhole, SearchDirection:=xlPrevious)
    
     If Not R Is Nothing Then
    
     ActiveSheet.Range(R.Address).Select
     ActiveCell.Offset(1, 0).Resize(AddTemplate.TxtNombre.Value + 3).EntireRow.Insert
    
    
     End With
    Tāches.png

    Let's say a user create a task that would start the 29/10/2020, i need to create that task in between the task that start the 28/10/2020 and the one that start the 02/11/2020.

    Anybody has an idea to get the immediate inferior date (if the exact one doesn't exist) ?





    Set R = .Cells.Find(what:=(<=)findStr, LookIn:=xlValues, lookat:=xlWhole, SearchDirection:=xlPrevious)
    Last edited by QcHuldar; 10-28-2020 at 05:28 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Macro to find the closest date and return the cell.address (inferior date)
    By QcHuldar in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-28-2020, 03:55 PM
  2. [SOLVED] Find exact text in exact cell but on any sheet?
    By nobodyukno in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-12-2017, 02:59 PM
  3. need formula or vba to find exact string through list and find exact correct string
    By johnlara in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-04-2016, 04:12 AM
  4. Exact Date and Time compare within a range of exact date and times Lookup and Flag
    By john2001 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-08-2015, 06:01 PM
  5. [SOLVED] Find the Exact date, Nearest old and new date for the given input Letter) and date
    By thilag in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-17-2015, 05:13 AM
  6. Replies: 4
    Last Post: 01-06-2015, 09:15 PM
  7. Find exact or closest lower date
    By ElmerS in forum Excel General
    Replies: 15
    Last Post: 12-19-2009, 10:08 AM

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