+ Reply to Thread
Results 1 to 3 of 3

find date and select columns C,D,E in row

Hybrid View

Burt_100 find date and select columns... 03-17-2015, 02:30 PM
JOHN H. DAVIS Re: find date and select... 03-17-2015, 03:02 PM
walruseggman Re: find date and select... 03-17-2015, 03:06 PM
  1. #1
    Forum Contributor
    Join Date
    06-17-2010
    Location
    Donemana, NI
    MS-Off Ver
    Excel 2007
    Posts
    386

    find date and select columns C,D,E in row

    Is it possible to have a macro which finds the date in sheet1 column a compared to sheet 2 A2 and select the columns C,D & E in that row so that I can paste data?

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: find date and select columns C,D,E in row

    Maybe:

    Sub Burt_100y()
    Dim r As Range
    Dim s As String
    Dim x As String, y As String, z As String
    
    s = Sheets("Sheet2").Range("A2").Value
    Sheets("Sheet1").Activate
    Set r = Columns(1).Find(s, LookIn:=xlValues, lookat:=xlPart)
        If Not r Is Nothing Then
            x = Cells(r.Row, "C").Address(False, False)
            y = Cells(r.Row, "D").Address(False, False)
            z = Cells(r.Row, "E").Address(False, False)
        End If
    Set r = Nothing
    Range(x) = "I Hope"
    Range(y) = "This"
    Range(z) = "Helps"
    End Sub
    Last edited by JOHN H. DAVIS; 03-17-2015 at 03:08 PM.

  3. #3
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: find date and select columns C,D,E in row

    This selects the cells C:E in the found date column. But for what it's worth, you rarely if ever need to select a range. You can just copy and paste it in the code without needing to select it.

    Sub Burt_100()
    
    Set c = Worksheets("Sheet1").Range("A:A").Find(Worksheets("Sheet2").Range("A2").Value)
    If Not c Is Nothing Then
        Range("C" & c.Row & ":E" & c.Row).Select
    End If
    
    End Sub

+ 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, select and copy data from specific date
    By Thijsvdberg in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-10-2014, 10:54 AM
  2. [SOLVED] Select certain columns based on certain date displayed in Row 1
    By **a*n*d*i** in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-18-2013, 09:58 PM
  3. Register - select the first date in the next month then delete the columns
    By dazza67 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-18-2013, 04:07 AM
  4. find date and select cell
    By sselemoh2012 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-01-2013, 06:44 AM
  5. Select certain columns based on date
    By segeorge in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-10-2007, 12:03 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