Results 1 to 4 of 4

Copy columns from one sheet to another if the header matches

Threaded View

  1. #1
    Registered User
    Join Date
    01-19-2010
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    2

    Copy columns from one sheet to another if the header matches

    Hi all-

    I have been cracking my brain on this for hours!
    The goal is to copy and paste a column whose header contains "Median" from Sheet1 into Column A of Sheet 2. Likewise copy a column which contains within it's header the word "sample" from Sheet 1 into Col B of Sheet 2 column B

    Please help! Thanks in advance

     Sub testoriginal()
    
    Dim A As Range
     
    Do
        Set A = Rows(1).Find(What:="Median", LookIn:=xlValues, lookat:=xlPart)
        If A Is Nothing Then Exit Do
        A.EntireColumn.Select
        Selection.Copy
        Sheets("Sheet2").Select
        Range("A1").Select
        ActiveSheet.Paste
    Loop
        Do
        Set A = Rows(1).Find(What:="Sample", LookIn:=xlValues, lookat:=xlPart)
        If A Is Nothing Then Exit Do
        A.EntireColumn.Select
        Selection.Copy
        Sheets("Sheet2").Select
        Range("B1").Select
        ActiveSheet.Paste
        Loop
    End Sub
    Last edited by Newbie111; 01-20-2010 at 12:57 PM.

Thread Information

Users Browsing this Thread

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

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