+ Reply to Thread
Results 1 to 3 of 3

VBA Cutting and Pasting from one worksheet to another based on value

Hybrid View

  1. #1
    Registered User
    Join Date
    07-13-2011
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2003
    Posts
    41

    VBA Cutting and Pasting from one worksheet to another based on value

    Hi All,

    I am almost there! I have code finding a value (Label5) from userform5 and finding that value in a spreadsheet (Pipeline) then cutting that row.

    Where I am stuck is how to then get it to paste that data in the last row of worksheet (B&P Archive). I cant seem to apply anything I've found searching to my instance. I am also going to have it do the cut and paste in another worksheet that's why you see the SS designations.

    Thanks in advance!

    Here is what I have so far:
    Private Sub CommandButton1_Click()Dim strFind
        Set ws = Worksheets("Pipeline")
        Set ws1 = Worksheets("SS")
        Set ws2 = Worksheets("B&P Archive")
        Set rSearch = ThisWorkbook.Worksheets("Pipeline").Range("B1:B300")
        Set rSearchSS = ThisWorkbook.Worksheets("SS").Range("B1:B300")
            Dim Nullstring
            Dim BPArchive As String
            Dim rSearch As Range 'range to search
            Dim rSearchSS As Range 'range to search
            Dim rngFind
            strFind = UserForm5.Label5
            If strFind = Nullstring Then GoTo error1
            With rSearch
                Set rngFind = .Find(What:=strFind, MatchCase:=True)
                If Not rngFind Is Nothing Then 'found it
                    ws.Select
    
    
    rngFind.EntireRow.Copy
    ThisWorkbook.Worksheets("B&P Archive").Select
    
    
    error1:
    End If
    End With
    End Sub

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: VBA Cutting and Pasting from one worksheet to another based on value

    Maybe

    rngFind.EntireRow.Copy Destination:=ThisWorkbook.Worksheets("B&P Archive").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
    Martin

  3. #3
    Registered User
    Join Date
    07-13-2011
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2003
    Posts
    41

    Re: VBA Cutting and Pasting from one worksheet to another based on value

    worked perfectly! Thank you!

+ 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. VBA for cutting and pasting a row based on one cell
    By JM88 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-13-2014, 11:38 PM
  2. Cutting row and pasting into new sheet based on criteria
    By goose1000 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-18-2011, 11:54 PM
  3. Inserting, Cutting, and Pasting Rows Based on What's in a Cell
    By 4EverLearning in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-05-2010, 04:42 PM
  4. Cutting/Pasting Rows based on content PT 2
    By Lmsloman in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-21-2006, 06:36 AM
  5. Help Please Cutting and pasting based on cell value
    By Mike in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-18-2005, 10:06 AM

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