+ Reply to Thread
Results 1 to 5 of 5

Finding a specified DATE, HELP required

  1. #1
    Registered User
    Join Date
    08-28-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2007
    Posts
    4

    Finding a specified DATE, HELP required

    Gday,

    I love this macro stuff it saves me soo much time but unfortunately I havent had any courses on it yet and Im pretty green.

    Anyway what I am trying to do is find the row where the date on sheet "Men U_D" is equal to the date in sheet "latest" cell B9. Then do some copying between the sheets ( no need to worry about that) but I'm really struggling with the dates thing any help would be much appreciated.

    Regards

    Alan O'Connor


    Sheets("latest").Range(B9).Select

    Dim **** As Date

    Set **** = Sheets("latest").Range(B9).Value


    Sheets("Men U_D").Select

    ActiveWindow.ScrollRow = 1
    Range("A1").Select

    Do While Cells(x, A).Value <> "****"
    x = x + 1

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Finding a specified DATE, HELP required

    It would be better if you could narrow the range on the "Men U_D" sheet. Try this:

    Please Login or Register  to view this content.

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Finding a specified DATE, HELP required

    Another method using Application.Match

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  4. #4
    Registered User
    Join Date
    08-28-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Finding a specified DATE, HELP required

    Hey thanks so much for the solutions, Alph Frog yours seemed to go the best.... I do have one really dumb question left though, how do I se;ect a cell in the row with the matching date?

    I tried


    Worksheets("Men U_D").Range("Jr").Select

    but I clearly dont know how the variants work so that didnt work..D'oh

  5. #5
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Finding a specified DATE, HELP required

    Try something like this...

    Worksheets("Men U_D").Select
    Range("J" & r).Select

    or
    Cells(r, "J").Select

    Also note; you do not need to select a cell to do something with it i.e., copy or paste. Selecting sheets and cells is very inefficient coding practice. The macro recorder records your selections because that's what you did with the mouse.

    This example will copy the value from Worksheets("Men U_D").Range("J" & r) to Sheets("latest").Range("A1") without selecting anything.
    Sheets("latest").Range("A1").Value = Worksheets("Men U_D").Range("J" & r).Value
    Last edited by AlphaFrog; 10-21-2013 at 11:12 PM.

+ 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. Help required with developing a error msgbox when end date is before start date
    By Graeme Smith in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-05-2013, 11:56 PM
  2. Replies: 1
    Last Post: 04-18-2012, 05:49 PM
  3. Current date to output required Date.
    By jay1983 in forum Excel General
    Replies: 3
    Last Post: 11-12-2009, 08:00 PM
  4. Formula required for date without changing the date format
    By suryaprasad in forum Excel General
    Replies: 1
    Last Post: 01-28-2009, 08:04 AM
  5. Finding links:no longer required
    By PeterG in forum Excel General
    Replies: 3
    Last Post: 06-17-2005, 01:05 PM

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