+ Reply to Thread
Results 1 to 2 of 2

Thread: Date Find

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

    Thumbs up Date Find

    Hi all,
    I realize that this has probably been asked a zillion times so if you know of a link I will gladly go to it or if not, help please.
    I have a source table that has 5 dates on it. My most current table from the source has these specific dates:
    June*2010
    May*2010
    June*2009
    May*2010
    June*2009
    They are in one row from E3 to I3
    I was hoping someone could point in the right VBA way to be able to see them so that I can copy them to our own table. Keep in mind I want this to be a generic find so that when the next update comes out ( and the values change), the code will still work. My idea up until now has been this:

    for each c in Range("A1:Z250")
    ....code to find them
    Selection.Copy
    ....Paste them to our sheet
    Next c
    Is there code that can be placed in the "code to find them" spot?

    Thanks to all that can help!!
    Last edited by Mordred; 08-06-2010 at 08:50 PM.
    Please leave a message after the beep!

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

    Re: Date Find

    With the help from DonkeyOte from a post he made on another site, this is solved. Sorry about all the documented explanations ( I know most of you don't need them) but it was a straight copy. Next time I see you online DonkeyOte I will hit the scales for you. Thanks.

    Dim rng As Range
        Dim num As Integer
        
        ''''This code performs a count in the "Dates" Range to determine the number of cells to be copied''''
        num = Worksheets("Insert").Range("Dates").Cells.SpecialCells(xlCellTypeConstants).Count
        
        Application.Worksheets("Insert").Select
        ''''This loop looks for cells that contain values in them and stops/selects the last cell with a ''''
        ''''value in it.''''
        For Each c In Range("Dates")
            If c.Value <> Empty Then c.Select
        Next c
        
        ''''This code selects all the cells that have values in them and prepares them for a copy.''''
        ActiveCell.End(xlToLeft).Resize(, num).Select
        Selection.Copy
    Please leave a message after the beep!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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.2.0