Results 1 to 12 of 12

How to move rows based on cell value to multiple tabs?

Threaded View

  1. #1
    Forum Contributor
    Join Date
    09-19-2016
    Location
    Alaska
    MS-Off Ver
    MS 2010, 2013, 2016
    Posts
    272

    How to move rows based on cell value to multiple tabs?

    Hi everyone I have the macro below that works well. I just need to expand on it and need some guidance.

    It currently moves data found in sheet 1 to sheet 2 if the values in column F = "Y". First, I would like the formulas on columns F:I to be copied to the last cell with data. Then, I need more conditions, for example if any cell in column "G" = No Issues Found, move to sheet 3, if cells in column "H" = Review then move to sheet 4 and if the cell in column "I" equals "Test Fail" then move to sheet5.

    Biggest issue I'm thinking is that some rows MIGHT need to be in multiple tabs but everything I found in Google deletes the row once it meets the first criteria.

    Sub MoveData()
    
        Dim xRg As Range
        Dim xCell As Range
        Dim I As Long
        Dim J As Long
        Dim K As Long
        Dim L As Long
        
        I = Worksheets("Sheet1").UsedRange.Rows.count
        J = Worksheets("Sheet2").UsedRange.Rows.count
        If J = 1 Then
           If Application.WorksheetFunction.CountA(Worksheets("Sheet2").UsedRange) = 0 Then J = 0
        End If
        Set xRg = Worksheets("Sheet1").Range("F1:F" & I)
        On Error Resume Next
        Application.ScreenUpdating = False
        For K = 1 To xRg.count
            If CStr(xRg(K).Value) = "Y" Then
                xRg(K).EntireRow.Copy Destination:=Worksheets("Sheet2").Range("A" & J + 2)
                xRg(K).EntireRow.Delete
                If CStr(xRg(K).Value) = "Y" Then
                    K = K - 1
                End If
                J = J + 1
            End If
        Next
        Application.ScreenUpdating = True
    End Sub
    Attached Files Attached Files
    Last edited by AccountingJ; 08-17-2020 at 12:57 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Move Rows to different Sheets based on Cell value(s) with Multiple Buttons
    By SeventySix in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-31-2019, 04:25 PM
  2. [SOLVED] VBA Change Event, Move multiple rows based on drop down selection for multiple criteria
    By Webbers in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-02-2017, 11:51 AM
  3. move rows to new sheet based on text and date in multiple sheets
    By myjebay1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-06-2014, 02:39 PM
  4. [SOLVED] Macros To Move Multiple Rows To Another Sheet And Macro To Move Single Rows To DAX Table
    By jcaynes in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-22-2013, 05:08 PM
  5. Replies: 1
    Last Post: 03-17-2013, 06:52 AM
  6. [SOLVED] Select rows based on date range and copy to multiple tabs
    By B-Rell in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-01-2012, 09:27 AM
  7. Replies: 1
    Last Post: 04-05-2012, 07:48 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