+ Reply to Thread
Results 1 to 3 of 3

Copy all cells in sheet1 that start with specific letters to one column in sheet2

Hybrid View

  1. #1
    Registered User
    Join Date
    11-30-2012
    Location
    Ohio
    MS-Off Ver
    Excel 2010
    Posts
    1

    Copy all cells in sheet1 that start with specific letters to one column in sheet2

    I have been trying to figure this one out for a week or so, I've tried molding other peoples solutions to fit my needs and can't seem to make it work.

    I have a sheet that has a lot of lab results. I need to search Sheet1 and find every cell that starts with the letters "SNP" and those cells' values to Column A on Sheet2. The order doesn't matter. The range is huge, 1000's of rows and columns to search, although very many of the cells are blank.

    I've attached a sample file with a much smaller data set, but i'd like to use some code where it will be easy to change out the search range, as i have many files that i need to do this to. The actual ranges are something like A1:EDP5130

    Thanks in advance for any help and suggestions!
    Attached Files Attached Files

  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: Copy all cells in sheet1 that start with specific letters to one column in sheet2

    Maybe:

    Sub jgabis()
    
    Dim rcell As Range
    
    Application.ScreenUpdating = False
    
    For Each rcell In ActiveSheet.UsedRange
    
        If Left(rcell, 3) = "SNP" Then
        
            rcell.Copy Sheets("Sheet2").Range("A" & Rows.Count).End(3)(2)
            
        End If
        
    Next rcell
    
    Application.ScreenUpdating = True
    
    End Sub

  3. #3
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Copy all cells in sheet1 that start with specific letters to one column in sheet2

    hi jgabis, option, run code "test"
    Attached Files Attached Files

+ Reply to Thread

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